I'm using Selenium and Ruby with IE 11 / and chrome
I'm trying to write a script that finds a specific piece of text in a table and returns the column and row which it exists.
I've found some close examples online but they were just returning the value in a cell, not returning the location of the text.
To find the object (text) itself I was using
varObject = driver.find_element(:xpath, "//*[contains(text(),'#{varDevice}')]")
driver.execute_script("arguments[0].style.border='3px solid red'", varObject) #Make sure I'm pointing to the correct text.
I wish I could attach the code for the table itself, but unfortunately I'm not allowed to share any code what-so-ever.
My goal is to take a table which column 1 row x has a checkbox and the text I'm trying to find is in column 2 row x and grab the row so that I will be able to click on checkbox in column 1 row x. Clicking on the checkbox is the easy part once I figure out what X is of the text I'm searching.
Example:
<html>
<body>
<table>
<tr>
<td>
*A check box*
</td>
<td> 192.168.0.0
</td>
</tr>
<tr>
<td>
*A check box*
</td>
<td> 192.168.0.100
</td>
</tr>
</body>
In this scenario I want to look for 192.168.0.100 and return that it is in row 2 so that I can click on the checkbox in row 2.
Thanks