c# - Selenium tests run on local machine but not through jenkins -
when running selenium tests c# in visual studio on local machine tests run fine , pass. when try run them on jenkins fail. if use firefox jenkins runs fine. problem though boss wants use ie because that's our company uses most.
here code failing run:
[testinitialize] public void openbrowser() { //start opening browser var options = new internetexploreroptions() { initialbrowserurl = baseurl, introduceinstabilitybyignoringprotectedmodesettings = true, ignorezoomlevel = true, enablenativeevents = false }; string ie_driver_path = @"c:\users\eedward7\desktop\selenium"; driver = new internetexplorerdriver(ie_driver_path, options); driver.manage().window.maximize(); driver.navigate().gotourl(this.baseurl); webdriverwait wait = new webdriverwait(driver, timespan.fromseconds(15)); wait.until(expectedconditions.visibilityofallelementslocatedby(by.id("ctl00_contentplaceholder1_login1_username"))); driver.findelementbyid("ctl00_contentplaceholder1_login1_username").sendkeys(userid); driver.findelementbyid("ctl00_contentplaceholder1_login1_password").sendkeys(password); wait.until(expectedconditions.visibilityofallelementslocatedby(by.id("ctl00_contentplaceholder1_login1_loginbutton"))); driver.findelementbyid("ctl00_contentplaceholder1_login1_loginbutton").click(); wait.until(expectedconditions.visibilityofallelementslocatedby(by.id("ctl00_treeview1t6"))); }
here jenkins error message:
initialization method selenium.tests.openbrowser threw exception. openqa.selenium.webdriverexception: openqa.selenium.webdriverexception: http request remote webdriver server url http://localhost:61076/session timed out after 60 seconds. ---> system.net.webexception: operation has timed out.
and last not least stacktrace:
at system.net.httpwebrequest.getresponse() @ openqa.selenium.remote.httpcommandexecutor.createresponse(webrequest request) --- end of inner exception stack trace --- @ openqa.selenium.remote.httpcommandexecutor.createresponse(webrequest request) @ openqa.selenium.remote.httpcommandexecutor.execute(command commandtoexecute) @ openqa.selenium.remote.driverservicecommandexecutor.execute(command commandtoexecute) @ openqa.selenium.remote.remotewebdriver.execute(string drivercommandtoexecute, dictionary`2 parameters) @ openqa.selenium.remote.remotewebdriver.startsession(icapabilities desiredcapabilities) @ openqa.selenium.remote.remotewebdriver..ctor(icommandexecutor commandexecutor, icapabilities desiredcapabilities) @ openqa.selenium.ie.internetexplorerdriver..ctor(string internetexplorerdriverserverdirectory, internetexploreroptions options) @ selenium.tests.openbrowser() in c:\users\eedward7\desktop\selenium\selenium\unittest1.cs:line 50
if has suggestions amazing because @ loss right on do.
try chromedriver these options
chromeoptions chromeoptions = new chromeoptions(); chromeoptions.addarguments("test-type"); chromeoptions.addarguments("no-sandbox"); new chromedriver(chromeoptions);
Comments
Post a Comment