c# - Page loads and the item is not found -
i test site. try put text input field (near site url:). use selenium. code throw exception. please, tell me why?
iwebdriver driver = new firefoxdriver(); try { driver.navigate().gotourl("http://www.w-global.com/index.php/tools-gadgets/online-sitemap-generator"); iwebelement url_parse = driver.findelement(by.name("inputurl")); url_parse.sendkeys("http://test.com"); } catch (exception ee) { string s = ee.tostring(); } { driver.quit(); } error:
openqa.selenium.nosuchelementexception: unable locate element: {\"method\":\"name\",\"selector\":\"inputurl\"}\r\n in openqa.selenium.remote.remotewebdriver.unpackandthrowonerror(response errorresponse) in c:\projects\webdriver\trunk\dotnet\src\webdriver\remote\remotewebdriver.cs...
change iwebelement url_parse = driver.findelement(by.tagname("inputurl")); iwebelement url_parse = driver.findelement(by.name("inputurl"));
update
just noticed element inside iframe.
you need switch before trying find element.
driver.switchto().frame("c-analyzer"); #and iwebelement url_parse = driver.findelement(by.name("inputurl"));
Comments
Post a Comment