org.openqa.selenium.NoSuchSessionException: такой сессии нет - PullRequest
0 голосов
/ 24 апреля 2018

Получение исключения «Нет такого сеанса» при доступе к описанному ниже методу в селене. Я знаю, что есть много одних и тех же вопросов с разными ответами в Интернете, но в моем случае ни один из них не решился Любая помощь?

Версия драйвера Chrome: - 2.38 Версия Chrome: -66.0.3359.117

Сообщение об исключении: -

org.openqa.selenium.NoSuchSessionException: no such session
  (Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Windows NT 10.0.10240 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
System info: host: 'XXYYXX', ip: 'XXYYXX', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_144'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.38.552522 (437e6fbedfa876..., userDataDir: C:\Users\XXYYXX\AppData\L...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 66.0.3359.117, webStorageEnabled: true}
Session ID: 6db82d5d19891c00f783fd9b7cebd234
*** Element info: {Using=xpath, value=html/body/div[1]/div/div/div[2]/div/div[2]/div/div/p}
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
    at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
    at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
    at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
    at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:346)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementsByXPath(RemoteWebDriver.java:425)
    at org.openqa.selenium.By$ByXPath.findElements(By.java:356)
    at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:307)
    at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:895)
    at org.openqa.selenium.support.ui.ExpectedConditions.access$000(ExpectedConditions.java:44)
    at org.openqa.selenium.support.ui.ExpectedConditions$7.apply(ExpectedConditions.java:206)
    at org.openqa.selenium.support.ui.ExpectedConditions$7.apply(ExpectedConditions.java:202)
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:248)
    at UserInterfaceTesting.LoginValidator.validation(LoginValidator.java:31)
    at HybridFrameWork.test1.validation_of_server_response_at_something_page(test1.java:41)
    at ?.And Validation of server response at "Login" Page(Userlogin.feature:14)

Моя программа: -

 else if (CommonObjRepository.getMessage().contentEquals("Login")) {


// This is where exception is being thrown //
            String Message = wait
                    .until(ExpectedConditions
                            .visibilityOfElementLocated(By.xpath("html/body/div[1]/div/div/div[2]/div/div[2]/div/div/p")))
                    .getText();

            assertEquals(ReadProperties.GetConstant("XXTTX"), Message);
            CommonObjRepository.getLog().info("***** XXXYYYZZZ *****");

        }

1 Ответ

0 голосов
/ 24 апреля 2018

Это сообщение об ошибке ...

org.openqa.selenium.NoSuchSessionException: no such session

... означает, что chromedriver = 2,38 не смог инициировать активный сеанс с WebClient, т.е. Chrome browser.

Ваша главная проблема - совместимость версий между двоичными файлами, которые вы используете следующим образом:

  • Хотя вы используете самую последнюю версию Selenium Client версия 3.11.0 , Драйвер Chrome версия 2,38 и Chrome версия 66.0
  • Ваша версия JDK - это 1.8.0_144 , что довольно давно.

Решение

  • Обновление JDK до последних уровней JDK 8u162 .
  • Очистить ваше Рабочее пространство проекта через IDE и Перестройте ваш проект только с необходимыми зависимостями.
  • Используйте CCleaner , чтобы стереть все дела ОС до и послевыполнениевашего комплекта тестов .
  • Если ваша базовая версия Web Client устарела, удалите ее через Revo Uninstaller и установите последнюю версию GA и выпущенную версию веб-клиента .
  • Выполните перезагрузку системы .
  • Выполните @Test.
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...