Find element by Text( ) attribute of span

3,207 views
Skip to first unread message

virendra chaudhary

unread,
Jul 6, 2014, 12:53:11 AM7/6/14
to seleniu...@googlegroups.com

Hi,
I am trying to access span element by xpath - "//span[@text() ='Training Video - 8']" for the below HTML

HTML Content

<td class="blue_mid_bg" width="203" valign="middle" height="43">
<span class="white_heading3">Training Video - 8</span>

but I am getting error -
Exception in thread "main" org.openqa.selenium.NoSuchElementException:
Unable to locate element: {"method":"xpath","selector":"//span[@text()='Training Video - 8']"}

Please help

Thanks

Ripon Al Wasim

unread,
Jul 7, 2014, 4:11:15 AM7/7/14
to seleniu...@googlegroups.com
Your xpath is wrong (omit @ before text()). It should be as follows:

"//span[text() ='Training Video - 8']"

Ripon


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/74143f30-1d6d-4466-9a56-a74e6caf2f28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages