Jenkins scheduling Selenium script cannot open the browser solution

Premise: The browser can be started in Myeclipse, but not in Jenkins

Reason : After installing jenkins programmatically, jenkins becomes a service of windows. By default, it is set to automatically start as shown in the figure below. Jenkins is a background service, so the browser is not displayed when running the selenium script.

Solution:

1. Right-click "Computer"->"Management"->"Services and Applications"->"Services", find the service "Jenkins", right-click the properties and change the startup type to "disabled" (this way, Jenkins will not run as a service)

2. Start Jenkins from the command line

java -jar "D:\Jenkins\jenkins.war"

You can also make a bat file, just double-click the bat file. The bat content is as follows:

  echo "Jenkins CI automation testting"
  java -jar "D:\Jenkins\jenkins.war"
  pause

3. Rebuild a Jenkins project and execute it.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324969965&siteId=291194637