Share
Go down
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 33
Location : Denver, CO

Solved:Unable to Locate Any Elements on Site

on Tue Jan 29, 2013 5:04 am
I am using Visual Studio with Selenium Webdriver and NUnit and I am unable to interact with any element on a page for this site. Selenium IDE can interact with most of it, but Webdriver can't interact with any. I used the same code against Google it works as expected so I know its not a set up error.

This is the html:


This is the command I use:
driver.FindElement(By.Id("txtDisplayName")).SendKeys("Display Name");

This is the error:
TestSelenium.Class1.AddClass:
OpenQA.Selenium.NoSuchElementException : Unable to find element with id == txtDisplayName

This is the log
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 983
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 844
at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 873
at OpenQA.Selenium.By.FindElement(ISearchContext context) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\By.cs:line 306
at TestSelenium.Class1.AddClass() in C:\Users\MyDocuments\Documents\Visual Studio 2010\Projects\TestSelenium\TestSelenium\Class1.cs:line 31


Last edited by ccox on Mon Feb 04, 2013 8:18 am; edited 1 time in total
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 33
Location : Denver, CO

Re: Solved:Unable to Locate Any Elements on Site

on Wed Jan 30, 2013 11:18 pm
Solved. If there is an iframe on the page, Webdriver has issues with location an element within that I frame. You have to switch to the iframe to find those elements and then switch back to the default content.
avatar
vinayakjadhav1857
Active particpant
Active particpant
Posts : 19
Join date : 2013-04-22

Re: Solved:Unable to Locate Any Elements on Site

on Mon Apr 22, 2013 1:52 pm
hey ccox,

what abt selecting multiple windows ?
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 33
Location : Denver, CO

Re: Solved:Unable to Locate Any Elements on Site

on Mon Apr 22, 2013 9:28 pm
driver.SwitchTo().Window("windowname");

If you do not know the window name/id you will need to use its handle.
Sponsored content

Re: Solved:Unable to Locate Any Elements on Site

Back to top
Permissions in this forum:
You cannot reply to topics in this forum