Unable to locate element Error using Webdriver

3,728 views
Skip to first unread message

Bhavana Thati

unread,
May 26, 2011, 7:15:27 PM5/26/11
to seleniu...@googlegroups.com
Hi All,
 
I'm getting below exception while working on selenium webdriver. This exception occurs when I use xpath, linktext or class name or label name etc. Also it is inconsistent exception as it works sometimes and fails mostly.
 
org.openqa.selenium.NoSuchElementException
: {"method":"class name","selector":"profile"}

System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_25'

WebElement we =

driver.findElement(By.linkText(....));

Thanks,
Bhavana

 

 

Mark Collin

unread,
May 27, 2011, 3:20:12 AM5/27/11
to seleniu...@googlegroups.com

It means that the element you are looking for doesn’t exist.  It’s exactly what is supposed to happen when it can’t find an element you are looking for.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.


-- This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify postm...@ardescosolutions.com

Jim Evans

unread,
May 27, 2011, 6:22:08 AM5/27/11
to Selenium Users
While what Mark says is certainly true, I'd like to point out that
there was an issue in 2.0b3 with finding by link text (in IE only) if
the page under test used certain JavaScript libraries, like jQuery.
The issue was fixed in the last couple of weeks. I wouldn't be
surprised if the next release fixed the problem.

And to forestall the inevitable question, no, I don't have a timeframe
for the next release. It should be soon, but I have nothing more
specific than that.

Regards,
--Jim
> For more options, visit this group athttp://groups.google.com/group/selenium-users?hl=en.
>
> --
> This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.
>
> If you have received this email in error please notify postmas...@ardescosolutions.com

srikar rao

unread,
May 27, 2011, 7:17:50 AM5/27/11
to Selenium Users, bhavana.th...@gmail.com
Hi,
its not issue in 2.0b3 or anything.
i'll explain you this problem with a clear example.
NoSuchElement found error message will come when the selenium is
trying to find the Element on look up.
Example:
Go to Salesforce.com, generate a testCase for creating a new Account
and save it.
Now click on name field a look will appear........... Selenium cannot
locate such Elements.
*** Because the look up will be generated dynamically.. As selenium
will try to locate the Element which is Static. But not the Dynamic
Element values.

Please Reply with your Quires.

srikar rao

unread,
May 27, 2011, 7:28:18 AM5/27/11
to Selenium Users
As Mark's subject is also a cause --> for your occurrence of problem.

Bhavana Thati

unread,
May 27, 2011, 6:14:42 PM5/27/11
to Selenium Users, pradeep....@gmail.com
Thanks for all your responses.

One point that I want to bring out is. It performs the action but
above mentioned exception is thrown. It could be selenium technical
issue as mentioned by srikar.

Currently we are unble to capture the test results accurately as our
logs are full of exceptions though the test is passed.

I would appreciate if someone can let me know some workaround to
handle this issue.

Thanks,
Bhavana
> > > > If you have received this email in error please notify postmas...@ardescosolutions.com- Hide quoted text -
>
> - Show quoted text -

srikar rao

unread,
May 28, 2011, 5:52:34 AM5/28/11
to Selenium Users, bhavan...@gmail.com
Hi all,
Yesterday I worked out on this problem.
finally I got sum stuff which would resolve some extent.

Well please debug your program and locate where the Selenium is Unable
to find the element.
Just above that statement place the following statement and spin it
again.


Thread.sleep(2000);

plz update the issue after trying this.

JohnChance

unread,
May 27, 2011, 4:26:42 AM5/27/11
to Selenium Users
Hi:
I had the same problem, and I just add a pause to let the page
finish loading, then problem solved.

On May 27, 7:15 am, Bhavana Thati <bhavana.th...@gmail.com> wrote:
>  Hi All,
>
> I'm getting below exception while working on selenium webdriver. This
> exception occurs when I use xpath, linktext or class name or label name etc.
> Also it is inconsistent exception as it works sometimes and fails mostly.
>
> *org.openqa.selenium.NoSuchElementException*: {"method":"class
> name","selector":"profile"}
>
> System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1',
> java.version: '1.6.0_25'
>
> WebElement we = driver.findElement(By.*linkText*(....));
>
> Thanks,
> Bhavana
Reply all
Reply to author
Forward
0 new messages