Click here to Skip to main content
15,891,694 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i wanted to locate the value of BNK1 using Selenium web driver by C#. but i having error

"no such element: Unable to locate element: {"method":"xpath","selector":"//table/tbody/tr/td[contains(text(),'BNK1')]"}"


HTML
<table id="myTable" class="TF">
<thread></thread>
<tbody>
<tr class="odd">
<td style="text-align: center">BNK1</td>
<td style="text-align: center">BNK2</td>
<td style="text-align: center">BNK3</td>


What I have tried:

C#
IWebElement element = driver.FindElement(By.XPath("//table/tbody/tr/td[contains(text(),'BNK1')]"));

C#
IWebElement element = driver.FindElement(By.XPath("//td[text()='BNK1']"));
Posted
Updated 11-Jun-20 3:33am

1 solution

Have you tried something like 'Selocity' (it's free) to confirm the path the element you're looking to hit ?

XPath and CSS Selector Generator | Ranorex Selocity Chrome Extension[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900