google chrome - C# Selenium Firefox NullReferenceException WebDriverException -
i've rebuilt development machine , i'm having issues running selenium tests. know there's issue setup when push new code , tests build server, pass without problem. tests used pass without problem before rebuild on machine too. i've reduced test case simplest possible in order try , isolate error.
- firefox: 21.0 (also produces same behaviour firefox 22.0 & 23.0)
- nuget packages: selenium.webdriver 2.40.0 & selenium.support 2.40.0
- visual studio 2010 sp1.
my site test site local asp.net mvc site , responds requests in less 200ms.
my simple failing case follows, attempting login:
using openqa.selenium.firefox; using openqa.selenium; using system.threading; class program { static void main(string[] args) { firefoxdriver driver = new firefoxdriver(); try { driver.navigate().gotourl("http://test.mysite.com/account/login/"); driver.findelement(by.name("username")).sendkeys("adminuser"); driver.findelement(by.name("password")).sendkeys("adminpassword"); driver.findelement(by.id("log-in-btn")).click(); } { driver.quit(); } } }
the problem doesn't fail , doesn't fail in same place. runs commands execute. @ other times of findelement lines fail following errors:
nullreferenceexception object reference not set instance of object @ openqa.selenium.remote.httpcommandexecutor.createresponse(webrequest request)
webdriverexception http request remote webdriver server url http://localhost:7055/hub/session/eff6f0c7-84e1-451d-adc8-1f02324d08ae/element
timed out after 60 seconds. @ openqa.selenium.remote.httpcommandexecutor.createresponse(webrequest request)
even when test raises 1 of above errors after while sat there doing nothing test browser remains responsive , 1 can manually complete tests.
i'm tearing hair out on this. in past couple of days i've tried many different combinations, e.g. different firefox versions, switching chrome, switching selenium.webdriver 2.39.0 same results.
i realise quite popular error selenium i'm hoping simple test case may assist in tracking down what's causing specific version of it.
selenium webdriver communicates browser using json on http, , since antivirus/anti-malware programs "hook" browsers, may inadvertently interfere or block valid traffic also.
turning off antivirus , firewall programs during testing or in test environments can resolve such issues.
Comments
Post a Comment