运行 来自 Jenkins 的 Cucumber 测试时浏览器未打开
Browser not opening when running Cucumber tests from Jenkins
我正在尝试 运行 从 Jenkins 配置了 Maven 的 Cucumber Selenium 项目,但是浏览器打不开并且执行失败。
当我使用 mvn test 从命令提示符执行同一个项目时,执行按预期进行。
下面是 Jenkins 的控制台输出
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.srinimarva.bigbasket.runner.customer.LoginATTest
#Author: Srinivasan Ramu
#Email: mailtorsrinivasan@gmail.com
@Login
Feature: To test the Login functionality using BigBasket, Facebook and Google credentials
Background: [90m# com/srinimarva/bigbasket/features/customer/Login.feature:6[0m
[32mGiven [0m[32mI open "[0m[32m[1mMozilla[0m[32m" browser to execute "[0m[32m[1mLoginTest[0m[32m"[0m [90m# CommonStepDefs.I_open_browser(String,String)[0m
[32mAnd [0m[32mI connect to "[0m[32m[1mhttp://www.bigbasket.com[0m[32m"[0m [90m# CommonStepDefs.connectURL(String)[0m
Unable to locate element: {"method":"xpath","selector":"html/body/div[18]/div[1]/div[2]/div[3]/span[1]/a"}
Command duration or timeout: 30.09 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.53.1', revision: 'a36b8b1cd5757287168e54b817830adce9b0158d', time: '2016-06-30 19:26:09'
System info: host: 'Srinivasans-MacBook-Pro.local', ip: '10.231.233.99', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.5', java.version: '1.7.0_79'
下面是pom.xml
的内容
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.srinimarva.bigbasket</groupId>
<artifactId>BigBasket</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>BigBasket</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-junit -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.4</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-core -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>1.2.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>
</dependencies>
</project>
你能帮我解决这个问题吗?
相信你是 运行 Jenkins 作为服务,这将显示一个后台进程。执行以下操作并希望这会锻炼身体
运行 -> Services.msc
右键单击 jenkins 和 select 允许服务与桌面交互 来自 登录选项卡
我的执行也从 Eclipse 以及命令提示符下的 mvn test 运行。
我遇到了一个类似的问题,我可以在 Jenkins 中看到 运行 在 'Console Output' 下的测试,但看不到浏览器 运行ning。它仅在我从服务中启用 Interactive Services Detection 并将其设置为 Manual 后才起作用。
您将能够看到一个弹出窗口,上面写着 'A program running on this computer is trying to display a message' 选项:
- 查看留言
- 稍后问我
要查看您的测试 运行,只需单击 'View the message',您将能够看到您的测试 运行。如果你想 return 到 Jenkins,只需单击 'Return'。
我正在尝试 运行 从 Jenkins 配置了 Maven 的 Cucumber Selenium 项目,但是浏览器打不开并且执行失败。
当我使用 mvn test 从命令提示符执行同一个项目时,执行按预期进行。
下面是 Jenkins 的控制台输出
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.srinimarva.bigbasket.runner.customer.LoginATTest
#Author: Srinivasan Ramu
#Email: mailtorsrinivasan@gmail.com
@Login
Feature: To test the Login functionality using BigBasket, Facebook and Google credentials
Background: [90m# com/srinimarva/bigbasket/features/customer/Login.feature:6[0m
[32mGiven [0m[32mI open "[0m[32m[1mMozilla[0m[32m" browser to execute "[0m[32m[1mLoginTest[0m[32m"[0m [90m# CommonStepDefs.I_open_browser(String,String)[0m
[32mAnd [0m[32mI connect to "[0m[32m[1mhttp://www.bigbasket.com[0m[32m"[0m [90m# CommonStepDefs.connectURL(String)[0m
Unable to locate element: {"method":"xpath","selector":"html/body/div[18]/div[1]/div[2]/div[3]/span[1]/a"}
Command duration or timeout: 30.09 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.53.1', revision: 'a36b8b1cd5757287168e54b817830adce9b0158d', time: '2016-06-30 19:26:09'
System info: host: 'Srinivasans-MacBook-Pro.local', ip: '10.231.233.99', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.5', java.version: '1.7.0_79'
下面是pom.xml
的内容<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.srinimarva.bigbasket</groupId>
<artifactId>BigBasket</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>BigBasket</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-junit -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.4</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-core -->
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>1.2.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>
</dependencies>
</project>
你能帮我解决这个问题吗?
相信你是 运行 Jenkins 作为服务,这将显示一个后台进程。执行以下操作并希望这会锻炼身体
运行 -> Services.msc
右键单击 jenkins 和 select 允许服务与桌面交互 来自 登录选项卡
我的执行也从 Eclipse 以及命令提示符下的 mvn test 运行。
我遇到了一个类似的问题,我可以在 Jenkins 中看到 运行 在 'Console Output' 下的测试,但看不到浏览器 运行ning。它仅在我从服务中启用 Interactive Services Detection 并将其设置为 Manual 后才起作用。
您将能够看到一个弹出窗口,上面写着 'A program running on this computer is trying to display a message' 选项:
- 查看留言
- 稍后问我
要查看您的测试 运行,只需单击 'View the message',您将能够看到您的测试 运行。如果你想 return 到 Jenkins,只需单击 'Return'。