How to launch chrome browser from Jenkins directly instead of using code in eclipse

南楼画角 提交于 2021-02-08 09:22:32

问题


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();

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

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.


回答1:


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.

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

Here is some documentation: https://github.com/SeleniumHQ/selenium/wiki/RemoteWebDriver

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




回答2:


If you have installed Jenkins as service then might be chrome is not launch and execution is completed in headless mode. If you want to launch chrome use jenkins .war instead of exe file



来源:https://stackoverflow.com/questions/48278408/how-to-launch-chrome-browser-from-jenkins-directly-instead-of-using-code-in-ecli

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!