如何直接从Jenkins启动Chrome浏览器,而不是在Eclipse中使用代码 [英] How to launch chrome browser from Jenkins directly instead of using code in eclipse

查看:149
本文介绍了如何直接从Jenkins启动Chrome浏览器,而不是在Eclipse中使用代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个用于Web自动化测试的maven项目,我正在使用下面的代码启动浏览器

I have created a maven project for Web automation tests I am using code below to launch browser

System.setProperty("webdriver.chrome.driver", "pathChromeDriver");
     driver = new ChromeDriver(); 
    driver.manage().window().maximize();

我也正在使用Jenkins执行我的测试套件,它工作正常.

Also I am using Jenkins to execute my test suite and it's working fine.

现在,我想从Jenkins配置浏览器启动操作,而不在我的maven项目中使用它.我们可以使用Jenkins中可用的插件吗?

Now I want to configure browser launch operation from Jenkins without using it in my maven project. Can we do this using plugins available in Jenkins ???

如果可以,请帮助我.

If yes then please help me with that.

推荐答案

您可以使用RemoteWebDriver.从詹金斯(Jenkins),确保有一台可以运行硒测试的机器.在此服务器上,您需要运行Selenium服务器和chromedriver.

What you could do is use RemoteWebDriver. From jenkins, make sure there is a machine where the selenium tests can run. On this server you need to run the Selenium Server and chromedriver.

然后从jenkins的构建计划中,设置机器的路径,插入环境变量,并通过remotewebdriver运行测试.

Then from the build plan in jenkins, set the path to the machine, insert the environment variables and have your tests run through remotewebdriver.

以下是一些文档: https://github.com/SeleniumHQ/selenium/wiki/RemoteWebDriver

对于Jenkins特定的Selenium插件: https://wiki.jenkins.io/display /JENKINS/硒+塞子

For Jenkins specific Selenium plugin: https://wiki.jenkins.io/display/JENKINS/Selenium+Plugin

这篇关于如何直接从Jenkins启动Chrome浏览器,而不是在Eclipse中使用代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆