Я пытался запустить коды селена через Jenkins (сервер / openshift).В машине Дженкинса для автоматизации тестирования - Selenium есть хромированный узел.Я получаю эту ошибку:
org.openqa.selenium.WebDriverException: неизвестная ошибка: не удалось запустить Chrome: аварийное завершение
Проверка работоспособности на узле jenkins Chrome-openshift.Поэтому мне не нужно устанавливать тип браузера как безголовый, кроме того, если я установил тип браузера как безголовый, он не сможет найти какой-либо компонент пользовательского интерфейса нашего приложения.Кстати, я разработал этот код с помощью cucumber / gherkin.
Он работает на локальном уровне с помощью maven clean-verify.
Это наш файл jenkins для запуска автоматического тестирования пользовательского интерфейса на jenkins:
stage('scm checkout') {
echo '****************************************\r*** scm checkout'
checkout scm
echo '*** show content ***'
sh "ls -lA"
}
stage('build artifact') {
echo '****************************************\r*** Build Artifact'
sh "mvn -V -B clean package"
}
stage('selenium GUI test') {
echo '****************************************\r*** Selenium GUI Test'
sh "mvn -V -B clean verify"
}
}
Это связанная часть pom.xml:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<executions>
<execution>
<configuration>
<forkCount>3</forkCount>
<reuseForks>true</reuseForks>
<encoding>UTF-8</encoding>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
<testFailureIgnore>true</testFailureIgnore>
<includes>
<includesFile>**/*UITestsRunner.java</includesFile>
</includes>
</configuration>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>3.8.0</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>testing</projectName>
<outputDirectory>target/cucumber-reports/advanced-reports</outputDirectory>
<cucumberOutput>target/cucumber-reports/CucumberTestReport.json</cucumberOutput>
<buildNumber>1</buildNumber>
<parallelTesting>false</parallelTesting>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Кроме того, это часть кода настроек веб-драйвера:
ChromeOptions options = new ChromeOptions();
options.addArguments("--no-sandbox"); //Bypass OS security model
options.addArguments("--disable-web-security");
options.addArguments("--ignore-urlfetcher-cert-requests");
//options.addArguments("--disable-renderer-backgrounding");
options.addArguments("--disable-infobars"); //Disabling infobars
//options.addArguments("--start-maximized"); //Open Browser in maximized mode
options.addArguments("--disable-dev-shm-usage"); //Overcome limited resource problem
options.setExperimentalOption("useAutomationExtension", false);
options.addArguments("--log-level=3"); // set log level
options.addArguments("--silent");
options.addArguments("--disable-gpu");
options.addArguments("window-size=1920,1080");
webDriver = new ChromeDriver(options);
Нет проблемна локальном, но на сервере, я получаю эту ошибку:
org.openqa.selenium.WebDriverException: неизвестная ошибка: не удалось запустить Chrome: аварийный выход (неизвестная ошибка: файл DevToolsActivePort не работаетне существует) (Процесс, запущенный из расположения chrome / usr / bin / google-chrome, больше не выполняется, поэтому ChromeDriver предполагает, что Chrome аварийно завершился.) (Информация о драйвере: chromedriver = 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72), платформа = Linux3.10.0-957.10.1.el7.x86_64 x86_64) (ВНИМАНИЕ: сервер не предоставил никакой информации о трассировке стека) Длительность команды или время ожидания: 287 миллисекунд Информация о сборке: версия: '3.5.2', ревизия: '10229a9', время: '2017-08-21T17: 29: 55.15Z' Информация о системе: хост: 'jenkins-agent-blue-1', ip: '127.0.1.1', os.name: 'Linux', os.arch:' amd64 ', os.version:' 3.10.0-957.10.1.el7.x86_64 ', java.version:' 1.8.0_192 'Информация о драйвере: driver.version: ChromeDriver в sun.reflect.NativeConstructorAccessorImpl.newInstance0 (собственный метод) в sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62) в sun.reflect.DelegatingConstructorAccessorImpl.new.jmp.jlj.mpl.java: 423) в org.openqa.selenium.remote.ErrorHandler.createThrowable (ErrorHandler.java:215) в org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed (ErrorHandler.java:167enrem..a. org).JsonWireProtocolResponse.lambda $ new $ 0 (JsonWireProtocolResponse.java:53) в org.openqa.selenium.remote.JsonWireProtocolResponse.lambda $ getResponseFunction $ 2 (JsonWireProtocolResponse.java:91) в orgenqa.selenium.remote.ProtocolHandshake.lambda $ createSession $ 24 (ProtocolHandshake.java:359) в java.util.stream.ReferencePipeline $ 3 $ 1.accept (ReferencePipeline.java:193) в java.util.Spliterators $ ArraySplitelizer.java: 958) в java.util.stream.ReferencePipeline.forEachWithCancel (ReferencePipeline.java:126) в java.util.stream.AbstractPipeline.copyIntoWithCancel (AbstractPipeline.java:498) в java.util.stream.AbstractPipeline.copyAbstractPipeline.java:485) в java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:471) в java.util.stream.FindOps $ FindOp.evaluateSequential (FindOps.java:152) в java.util.stream.AbstractPipe.evaluate (AbstractPipeline.java:234) в java.util.stream.ReferencePipeline.findFirst (ReferencePipeline.java:464) в org.openqa.selenium.remote.ProtocolHandshake.createSession (ProtocolHandshake.java:362) в org.enq.selenium.remote.ProtocolHandshake.createSession (ProtocolHandshake.java:136) в org.openqa.selenium.remote.HttpCommandExecutor.execute (HttpCommandExecutor.java:142) в org.openqa.selenium.remote.service.DriverCommandExecutor.execute (DriverCommandExecutor.java:82)в org.openqa.selenium.remote.RemoteWebDriver.execute (RemoteWebDriver.java:641) в org.openqa.selenium.remote.RemoteWebDriver.startSession (RemoteWebDriver.java:254) в org.openqoteri.art..(RemoteWebDriver.java:236) в org.openqa.selenium.remote.RemoteWebDriver. (RemoteWebDriver.java:137) в org.openqa.selenium.chrome.ChromeDriver. (ChromeDriver.java:178) в org.openq.chrome.ChromeDriver. (ChromeDriver.java:167) в org.openqa.selenium.chrome.ChromeDriver. (ChromeDriver.java:156)
Я использую Chrome (версия 73 ) и ChromeDriver (версия 73.0.3683.68 ) локально, как и в узле chrome (jenkins).