Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
Vinay
Posts : 2
Join date : 2011-11-23

Facing problem with element locator Empty Facing problem with element locator

Wed Nov 23, 2011 4:44 pm
I am using Webdriver API and selenium-server-standalone-2.11.0 , junit,firefox to automate my proj on SAP Business Objects Platform.But i am facing errors in each and every line...I used Xpath even by add on(Firebug and Fire path).The code i have used is below and i have mentioned the errors.Could anyone please help in resolving these?

//Error: Username text edit element not found
driver
.findElement(By.id("usernameTextEdit")).clear();
//driver.findElement(By.xpath("//input[@id='usernameTextEdit']")).clear();
driver.findElement(By.id("usernameTextEdit")).sendKeys("Vinay");
//driver.findElement(By.xpath("//input[@id='usernameTextEdit']")).sendKeys("Vinay");

//Error: Password text edit element not found

driverfindElement(By.id("passwordTextEdit")).clear();

driver.findElement(By.id("passwordTextEdit")).sendKeys("Ab1234");
driver.findElement(By.cssSelector("input.logon_button.logon_button_hover")).click();
//driver.findElement(By.xpath("//input[@value='Log On']")).click();

//Window doesn't exist.
// ERROR: Caught exception [ERROR: Unsupported command [selectWindow]]
driver.findElement(By.linkText("Document List")).click();

//Navigate to Customer report and should open the report.
driver.findElement(By.id([size=9]"ListingURE_treeNode4_name")).click();
avatar
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Facing problem with element locator Empty Re: Facing problem with element locator

Wed Nov 23, 2011 8:13 pm
What is the content of this error and accurate id of elements?
I don't understand that: "Username text edit" is in error and id of an element is "usernameTextEdit". Is it just the example data for the post?

When you use xPath, Selenium is not showing any error?

If errors are displayed regardless of whether you use xpath or id, or something else, you have to see if selenium is on the correct and proper page, when referring to these elements.
avatar
Vinay
Posts : 2
Join date : 2011-11-23

Facing problem with element locator Empty Re: Facing problem with element locator

Wed Nov 23, 2011 9:00 pm
faramka wrote:What is the content of this error and accurate id of elements?
I don't understand that: "Username text edit" is in error and id of an element is "usernameTextEdit". Is it just the example data for the post?

When you use xPath, Selenium is not showing any error?

If errors are displayed regardless of whether you use xpath or id, or something else, you have to see if selenium is on the correct and proper page, when referring to these elements.



Thanks for your Reply!!!

Here are the details

"Username text edit" is not Error... It is Filed where selenium is throwing error.

Error message is:org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"usernameTextEdit"}; duration or timeout: 30.06 seconds

Even I tried by using Xpath also same error is persisting

driver.findElement(By.xpath("//input[@id='usernameTextEdit']")).sendKeys("Vinay");

Error message is:org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"usernameTextEdit"}; duration or timeout: 30.06 seconds
avatar
ccnnll
Posts : 6
Join date : 2011-12-03

Facing problem with element locator Empty Timing?

Sat Dec 03, 2011 3:43 am
Sometimes I've run into this as a timing issue. The script tries to find the element before it has finished rendering. Try adding a Thread.sleep(1000) before the FindElement to see if that helps. (Later you'd want to write something more like a global waitForElement function.)
avatar
qappbc
Amateur
Amateur
Posts : 38
Join date : 2011-10-13

Facing problem with element locator Empty Re: Facing problem with element locator

Sat Dec 03, 2011 7:51 am
ccnnil is likely correct and when to call the 'wait' state. But I would recommend the WebDriver supplied 'implicit wait' - or if you know what to wait for, then use explicit wait.

"An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to find an element or elements if they are not immediately available. The default setting is 0. Once set, the implicit wait is set for the life of the WebDriver object instance."

driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
satyamsing
satyamsing
Posts : 3
Join date : 2011-11-04

Facing problem with element locator Empty Element locator not found due to improper timing

Mon Jan 16, 2012 7:15 pm
When web elements are not found intermittently then the issue is most likely of timing. Depending on the loading constraints of the web page under test the WebElements are not found intermittently. A raw fix is to make the thread sleep for the time which you think is sufficient for the webelements to be available. An example would be:

WebDriver driver; (defined earlier)

driver.findElement(By.ID(ID_XXX)).click();
[size=9]
Thread.sleep(sleeptime);

Another method is to increase the wait using the following code:
WebDriver.Timeouts implicitlyWait(long time,
java.util.concurrent.TimeUnit unit)


For WebDriver and browser automation details visit:

http://seleniumhq.org/docs/

http://satyamsing.blogspot.com/2012/01/selenium-webdriver-interface.html

http://satyamsing.blogspot.com/2012/01/webdriver-better-tool.html

http://satyamsing.blogspot.com/2012/01/agile-identifying-when-and-what-to.html


Last edited by satyamsing on Mon Jan 16, 2012 7:18 pm; edited 1 time in total (Reason for editing : formatting)
Sponsored content

Facing problem with element locator Empty Re: Facing problem with element locator

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