无法发现打开的页面。无法在Chrome浏览器中使用jenkins运行我的测试套件

时间:2016-07-28 09:06:12

标签: maven selenium jenkins webdriver selenium-chromedriver

我正在获得此堆栈跟踪。

Default Logging level is set to ERROR
Loping for  strBrowserType chrome
Starting ChromeDriver (v2.9.248315) on port 42027
Tests run: 32, Failures: 1, Errors: 0, Skipped: 31, Time elapsed: 67.337 sec <<< FAILURE! - in TestSuite
setupSuite(com.ambab.carworkz.testcases.ServiceEstimatorTestTc)  Time elapsed: 66.668 sec  <<< FAILURE!
org.openqa.selenium.WebDriverException: 
unknown error: unable to discover open pages
  (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 61.06 seconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'ROBER-QA', ip: '192.168.0.70', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_91'
Driver info: org.openqa.selenium.chrome.ChromeDriver

结果:

Failed tests: 
  ServiceEstimatorTestTc>Base.setupSuite:114 » WebDriver unknown error: unable t...

Tests run: 32, Failures: 1, Errors: 0, Skipped: 31

[ERROR] There are test failures.

我正在使用chrome浏览器中的jenkins运行测试套件,这是我遇到此问题的时候。如果我直接从eclipse IDE运行该套件,那么它运行正常。当我在firefox中运行相同的测试套件时,它运行正常。

我已经安装了最新版本的chrome和chrome驱动程序。与maven一起运行jenkins工作。

尝试使用no-sandbox以及自动检测设置的Chrome浏览器设置的更改。詹金斯我也在主人身上工作,没有奴隶。尝试了解这个问题的所有可能解决方案。如果有更多解决方案,那么请告诉我。

1 个答案:

答案 0 :(得分:0)

我添加了这些东西,它解决了我的情况。运行jenkins的用户也可能存在问题(应该设置为Admin)

ChromeOptions options = new ChromeOptions(); options.AddUserProfilePreference("download.default_directory", DownloadsPath); options.SetLoggingPreference(LogType.Browser, LogLevel.Severe); options.AddArguments("ignore-certificate-errors"); options.AddArguments("--allow-running-insecure-content"); options.AddArguments("test-type"); options.AddArguments("start-maximized"); options.AddArguments("--disable-extensions"); options.AddArguments("no-sandbox"); var ChromeService = ChromeDriverService.CreateDefaultService(); ChromeService.HideCommandPromptWindow = true; instance = new ChromeDriver(ChromeService, options, TimeSpan.FromSeconds(200));