Previous post installation tutorial: https://www.cnblogs.com/linuxchao/p/linuxchao-jenkins-setup.html
I. Foreplay
The last article after installing the JDK and Jenkins, in the use of the time encountered a lot of problems, and now one by one to share with you
Two. Question 1
1. Purpose: Because for the first time using Jenkins, it is less likely to be used, to give yourself a small goal is to execute a python script
2. Process
There is no pre-configured Jenkins directly open to start a new task (procedure omitted, nothing configured, just executed such a command Python *.py), just started to learn or have used the students should be able to understand what I said.
OK, go ahead, next is "Build Now", the problem is, execute such a simple script since give me an error. Yes, the error message means I can't find the selenium bag.
1Ft1.1:importerror:failed toImportTest MODULE:LOGINTC2 Traceback (most recent):3File"C:\Python36\lib\unittest\loader.py", line 428,inch_find_test_path4module =self._get_module_from_name (name)5File"C:\Python36\lib\unittest\loader.py", line 369,inch_get_module_from_name6 __import__(name)7File"D:\Petrochina_Retail_Test_Project\retail\test_case\LoginTc.py", line 11,inch<module>8 fromRetail.test_case.models.myunitImportmyunittest9File"D:\Petrochina_Retail_Test_Project\retail\test_case\models\myunit.py", Line 7,inch<module>Ten fromRetail.test_case.models.driverImportWdriver OneFile"D:\Petrochina_Retail_Test_Project\retail\test_case\models\driver.py", Line 7,inch<module> A fromSeleniumImportWebdriver -Modulenotfounderror:no module named'Selenium'
3. Solution: Run this script in the IDE no problem, run in cmd no problem, very hurt, look at the various environment variables found no problem, so uninstall Jenkins reinstall try to find it or not, after a few hours of tossing, found that indeed in the Python installation directory of C: \ There are no selenium packages under python36\lib\site-packages. may have been the CMD and the IDE to flicker, I went to find out where the IDE in the introduction of the Seleniium package, the key came, look at the picture:
You now see the directory is I changed, the original directory is: C:\users\v-xug\appdata\roaming\python\python36\site-packages very strange why here, It was installed when I set myself to this directory, resulting in Jenkins looking for selenium package can not find, so the selenium copied to the Python directory inside, build again
Three. Question 2
1. Process: Found a new problem, the script was executed and the Jenkins console did not error, but my script has to execute Open browser operation, I can actually not see the browser is opened, the execution is finished
2. Resolution: Sad! Baidu. Find such an article Jenkins dispatch selenium script does not open browser workaround
Then follow the above steps to start the operation, the problem I found that I can not run the Java command, the message is that my JDK is 11 and Jenkins needs to run JDK8 and then uninstall the JDK reinstall version 8. Step by step, are done after the surprise found really solved, very happy! This article is very messy, because a lot of things I did not record, can not see some error messages, but the general problem is this, hope to meet the same situation of the students to help you a little bit busy.
Jenkins dispatch Selenium script does not open browser workaround
Posted: 2016-7-27 10:56 Autumn seeks grass Source: 51Testing Software test Network editing
Font: Big Small | Previous post | Next | I want to contribute | Recommended Tags: software testing tools Jenkins Selenium automated test tools
The
WebBrowser doesn ' t show while run selenium test via
Jenkins
Reason:Because Jenkins is a service installed with Windows Installer to Windows, Jenkins is a back-end service, so running selenium cases does not show
Browser
Workaround:
Step 1. Control Panel, Administrative Tools (management tools), Services (service)Find Jenkins, right-click menu, execute Stop, right-click menu "Properties" Start type Select "Disabled" tap apply, click OK. (This step: Let Jenkins not run in the background as a Windows service)
Step2. Start Jenkins from the command line
Java-jar "D:\Program files (x86) \jenkins\jenkins.war" Of course, you can also make a bat file, each time you start Jenkins, double-click Run this bat file is OK, the bat file content is as follows: Echo " Jenkins CI Automation testting "Java-jar" D:\Program Files (x86) \jenkins\jenkins.war "Pause
Step3. Re-create the job of Jenkins, reconfigure it, perform the test The problem is solved.
Note the problem:(1) Starting Jenkins this way, the data that was previously started with Jenkins in Windows service was lost and the job needs to be recreated. (2) The plug-in installed in Jenkins prior to Windows service startup is not available, and the required plugins need to be reinstalled.
Jenkins use start pit (1)