Перейти к содержимому

Фотография

Не запускаются тесты в IE11 и в Firefox


  • Авторизуйтесь для ответа в теме
Сообщений в теме: 5

#1 Aleksey_2

Aleksey_2

    Новый участник

  • Members
  • Pip
  • 17 сообщений

Отправлено 22 мая 2018 - 14:14

Привет. Написал самый элементарный тест. В Хроме. Запустил, всё работает.

Пытаюсь в IE11 запустить.

Дописал:

import org.openqa.selenium.ie.InternetExplorerDriver;

Далее:

// System.setProperty("webdriver.chrome.driver", "C:\\Tools\\chromedriver.exe");
System.setProperty("webdriver.ie.driver", "C:\\Tools\\IEDriverServer.exe");
// driver = new ChromeDriver();
driver = new InternetExplorerDriver();
// driver = new FirefoxDriver();

Запускаю. Возникает пустое окно IE с надписью "This is the initial start page for the WebDriver server.". Потом в консоли среды IDEA ошибка:

 

"Started InternetExplorerDriver server (32-bit)
3.12.0.0
Listening on port 24367
Only local connections are allowed

org.openqa.selenium.remote.SessionNotFoundException: session null does not exist (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 0 milliseconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'DESKTOP-3RL45DT', ip: '192.168.0.98', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '9.0.1'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{capabilities={proxy={}, acceptInsecureCerts=false, browserVersion=11, se:ieOptions={nativeEvents=true, browserAttachTimeout=0, ie.ensureCleanSession=false, elementScrollBehavior=0, enablePersistentHover=true, ie.browserCommandLineSwitches=, ie.forceCreateProcessApi=false, requireWindowFocus=false, initialBrowserUrl=http://localhost:24367/, ignoreZoomSetting=false, ie.fileUploadDialogTimeout=3000, ignoreProtectedModeSettings=false}, timeouts={implicit=0, pageLoad=300000, script=30000}, browserName=internet explorer, pageLoadStrategy=normal, unhandledPromptBehavior=dismiss, platformName=windows, setWindowRect=true}, sessionId=e437cd11-b249-4d88-b5ea-8cdcc0156ac4, platform=ANY}]
Session ID: null

.......

......."

 

Ну и так далее, текст длинный. Я так понимаю сама ошибка в начале пишется, то есть:

org.openqa.selenium.remote.SessionNotFoundException: session null does not exist (WARNING: The server did not provide any stacktrace information)
 

Всё перегуглил. Там разные советы: одинаковые настройки безопасности IE, окно 100%, запустить файл selenium-server-standalone-3.12.0.jar. Ничего не помогает.

 

Можете помочь?

 

P.S.: аналогично в Firefox ничего не работает.

 

 


  • 0

#2 Aleksey_2

Aleksey_2

    Новый участник

  • Members
  • Pip
  • 17 сообщений

Отправлено 22 мая 2018 - 14:16

Весь код такой:

package com.gmail.alex;

import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.concurrent.TimeUnit;
import static org.openqa.selenium.support.ui.ExpectedConditions.titleIs;

public class MyTest {

private static WebDriver driver;
// private static InternetExplorerDriver driver;
private static WebDriverWait wait;

@BeforeClass
public static void start(){
// System.setProperty("webdriver.chrome.driver", "C:\\Tools\\chromedriver.exe");
System.setProperty("webdriver.ie.driver", "C:\\Tools\\IEDriverServer.exe");
// driver = new ChromeDriver();
driver = new InternetExplorerDriver();
// driver = new FirefoxDriver();

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().window().maximize();
wait = new WebDriverWait(driver, 10);
}

@Test
public void myTest(){
// Две аналогичные команды:
// driver.navigate().to("https://www.google.ru/");
driver.get("https://www.google.ru/");

// Найти поле для ввода текста и ввести значение:
// driver.findElement(By.name("q")).sendKeys("webdriver");
WebElement q = driver.findElement(By.name("q"));
q.sendKeys("webdriver");

// Нажать клавишу Enter:
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);

wait.until(titleIs("webdriver - Поиск в Google"));
}

// После выполнения теста драйвер останавливается:
@After
public void stop(){
driver.quit(); // закрыть брвузер
driver = null;
}
}

  • 0

#3 Aleksey_2

Aleksey_2

    Новый участник

  • Members
  • Pip
  • 17 сообщений

Отправлено 22 мая 2018 - 14:21

Весь текст ошибки в консоли:

"C:\Program Files\Java\jdk-9.0.1\bin\java" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.5\lib\idea_rt.jar=50643:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.5\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.5\lib\idea_rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.5\plugins\junit\lib\junit-rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.5\plugins\junit\lib\junit5-rt.jar;D:\ОБЩИЕ_ДОКУМЕНТЫ\IT\autotest\lesson-20\target\test-classes;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-java\2.53.0\selenium-java-2.53.0.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-chrome-driver\2.53.0\selenium-chrome-driver-2.53.0.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-remote-driver\2.53.0\selenium-remote-driver-2.53.0.jar;C:\Users\alexw\.m2\repository\cglib\cglib-nodep\2.1_3\cglib-nodep-2.1_3.jar;C:\Users\alexw\.m2\repository\com\google\code\gson\gson\2.3.1\gson-2.3.1.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-api\2.53.0\selenium-api-2.53.0.jar;C:\Users\alexw\.m2\repository\org\apache\httpcomponents\httpclient\4.5.1\httpclient-4.5.1.jar;C:\Users\alexw\.m2\repository\org\apache\httpcomponents\httpcore\4.4.3\httpcore-4.4.3.jar;C:\Users\alexw\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\alexw\.m2\repository\commons-codec\commons-codec\1.9\commons-codec-1.9.jar;C:\Users\alexw\.m2\repository\com\google\guava\guava\19.0\guava-19.0.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-edge-driver\2.53.0\selenium-edge-driver-2.53.0.jar;C:\Users\alexw\.m2\repository\commons-io\commons-io\2.4\commons-io-2.4.jar;C:\Users\alexw\.m2\repository\org\apache\commons\commons-exec\1.3\commons-exec-1.3.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-firefox-driver\2.53.0\selenium-firefox-driver-2.53.0.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-ie-driver\2.53.0\selenium-ie-driver-2.53.0.jar;C:\Users\alexw\.m2\repository\net\java\dev\jna\jna\4.1.0\jna-4.1.0.jar;C:\Users\alexw\.m2\repository\net\java\dev\jna\jna-platform\4.1.0\jna-platform-4.1.0.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-safari-driver\2.53.0\selenium-safari-driver-2.53.0.jar;C:\Users\alexw\.m2\repository\io\netty\netty\3.5.7.Final\netty-3.5.7.Final.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-support\2.53.0\selenium-support-2.53.0.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-leg-rc\2.53.0\selenium-leg-rc-2.53.0.jar;C:\Users\alexw\.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\alexw\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.gmail.alex.MyTest
Started InternetExplorerDriver server (32-bit)
3.12.0.0
Listening on port 24367
Only local connections are allowed

org.openqa.selenium.remote.SessionNotFoundException: session null does not exist (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'DESKTOP-3RL45DT', ip: '192.168.0.98', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '9.0.1'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{capabilities={proxy={}, acceptInsecureCerts=false, browserVersion=11, se:ieOptions={nativeEvents=true, browserAttachTimeout=0, ie.ensureCleanSession=false, elementScrollBehavior=0, enablePersistentHover=true, ie.browserCommandLineSwitches=, ie.forceCreateProcessApi=false, requireWindowFocus=false, initialBrowserUrl=http://localhost:24367/, ignoreZoomSetting=false, ie.fileUploadDialogTimeout=3000, ignoreProtectedModeSettings=false}, timeouts={implicit=0, pageLoad=300000, script=30000}, browserName=internet explorer, pageLoadStrategy=normal, unhandledPromptBehavior=dismiss, platformName=windows, setWindowRect=true}, sessionId=e437cd11-b249-4d88-b5ea-8cdcc0156ac4, platform=ANY}]
Session ID: null

    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
    at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteTimeouts.implicitlyWait(RemoteWebDriver.java:865)
    at com.gmail.alex.MyTest.start(MyTest.java:33)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)


Test ignored.

Process finished with exit code -1


  • 0

#4 Alex

Alex

    Постоянный участник

  • Members
  • PipPipPip
  • 237 сообщений
  • ФИО:Алексей

Отправлено 23 мая 2018 - 05:20

 

Весь текст ошибки в консоли:

"C:\Program Files\Java\jdk-9.0.1\bin\java" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.5\lib\idea_rt.jar=50643:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.5\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.5\lib\idea_rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.5\plugins\junit\lib\junit-rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.5\plugins\junit\lib\junit5-rt.jar;D:\ОБЩИЕ_ДОКУМЕНТЫ\IT\autotest\lesson-20\target\test-classes;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-java\2.53.0\selenium-java-2.53.0.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-chrome-driver\2.53.0\selenium-chrome-driver-2.53.0.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-remote-driver\2.53.0\selenium-remote-driver-2.53.0.jar;C:\Users\alexw\.m2\repository\cglib\cglib-nodep\2.1_3\cglib-nodep-2.1_3.jar;C:\Users\alexw\.m2\repository\com\google\code\gson\gson\2.3.1\gson-2.3.1.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-api\2.53.0\selenium-api-2.53.0.jar;C:\Users\alexw\.m2\repository\org\apache\httpcomponents\httpclient\4.5.1\httpclient-4.5.1.jar;C:\Users\alexw\.m2\repository\org\apache\httpcomponents\httpcore\4.4.3\httpcore-4.4.3.jar;C:\Users\alexw\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\alexw\.m2\repository\commons-codec\commons-codec\1.9\commons-codec-1.9.jar;C:\Users\alexw\.m2\repository\com\google\guava\guava\19.0\guava-19.0.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-edge-driver\2.53.0\selenium-edge-driver-2.53.0.jar;C:\Users\alexw\.m2\repository\commons-io\commons-io\2.4\commons-io-2.4.jar;C:\Users\alexw\.m2\repository\org\apache\commons\commons-exec\1.3\commons-exec-1.3.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-firefox-driver\2.53.0\selenium-firefox-driver-2.53.0.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-ie-driver\2.53.0\selenium-ie-driver-2.53.0.jar;C:\Users\alexw\.m2\repository\net\java\dev\jna\jna\4.1.0\jna-4.1.0.jar;C:\Users\alexw\.m2\repository\net\java\dev\jna\jna-platform\4.1.0\jna-platform-4.1.0.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-safari-driver\2.53.0\selenium-safari-driver-2.53.0.jar;C:\Users\alexw\.m2\repository\io\netty\netty\3.5.7.Final\netty-3.5.7.Final.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-support\2.53.0\selenium-support-2.53.0.jar;C:\Users\alexw\.m2\repository\org\seleniumhq\selenium\selenium-leg-rc\2.53.0\selenium-leg-rc-2.53.0.jar;C:\Users\alexw\.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\alexw\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.gmail.alex.MyTest
Started InternetExplorerDriver server (32-bit)
3.12.0.0
Listening on port 24367
Only local connections are allowed

org.openqa.selenium.remote.SessionNotFoundException: session null does not exist (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'DESKTOP-3RL45DT', ip: '192.168.0.98', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '9.0.1'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{capabilities={proxy={}, acceptInsecureCerts=false, browserVersion=11, se:ieOptions={nativeEvents=true, browserAttachTimeout=0, ie.ensureCleanSession=false, elementScrollBehavior=0, enablePersistentHover=true, ie.browserCommandLineSwitches=, ie.forceCreateProcessApi=false, requireWindowFocus=false, initialBrowserUrl=http://localhost:24367/, ignoreZoomSetting=false, ie.fileUploadDialogTimeout=3000, ignoreProtectedModeSettings=false}, timeouts={implicit=0, pageLoad=300000, script=30000}, browserName=internet explorer, pageLoadStrategy=normal, unhandledPromptBehavior=dismiss, platformName=windows, setWindowRect=true}, sessionId=e437cd11-b249-4d88-b5ea-8cdcc0156ac4, platform=ANY}]
Session ID: null

    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
    at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteTimeouts.implicitlyWait(RemoteWebDriver.java:865)
    at com.gmail.alex.MyTest.start(MyTest.java:33)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)


Test ignored.

Process finished with exit code -1

Судя по всему есть какая-то несовеместимость. IEDriver 64 или 32 бит? Если 64, то нужно пробовать 32. Версия драйвера последняя? Какой IE хотите запустить (версия)?


  • 1

#5 Aleksey_2

Aleksey_2

    Новый участник

  • Members
  • Pip
  • 17 сообщений

Отправлено 23 мая 2018 - 14:40

 

 

Весь текст ошибки в консоли:

// ...

Судя по всему есть какая-то несовеместимость. IEDriver 64 или 32 бит? Если 64, то нужно пробовать 32. Версия драйвера последняя? Какой IE хотите запустить (версия)?

 

привет. спасибо за совет. дело оказалось в версии библиотеки селениум )


  • 0

#6 Aleksey_2

Aleksey_2

    Новый участник

  • Members
  • Pip
  • 17 сообщений

Отправлено 23 мая 2018 - 14:42

В итоге оказалось, что проблема была в том что использовал библиотеку селениум версии 2.53.0. Прописал в pom-файле версию 3.8.0 и заработало!)

<dependencies>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.8.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>

  • 0


Количество пользователей, читающих эту тему: 0

0 пользователей, 0 гостей, 0 анонимных