问题
I am running pytests selenium tests using jenkins. I ran test on my local machine it works. But when I run through jenkins, it runs on remote jenkins machine(creates workspace on remote jenkins machine) headlessly and it fails with test errors such as 'element not visible' or 'timeout exception due to element not clickable'. After this I ran test on remote machine directly (windows server) in workspace. It launches chrome browser and runs test and passes.
- Why is it running test headlessly when run through jenknis?
- Can I make it to force open browser while running through jenkins?
- Why tests are failing when ran through jenkins headlessly?
回答1:
I assume that your Jenkins is running as service on that machine under Windows, there are 2 things you may want to try at this point:
- Specify local system account in service and check allow service to interact with desktop. More on how to do it in here. However, it could result in other issues.
- Run your jenkins instance from WAR file, case you're running your tests on slave machine: start jenkins slave from command line.
来源:https://stackoverflow.com/questions/44374797/jenkins-selenium-do-not-run-test-headlessly