I have a Web browser's app UI Table as shown like this...
DATAPOINT VALUE STATUS
Output Voltage 95.0 VAC Nominal
PS Input Voltage 15.0 VAC Nominal
Inverter Status Off Nominal
Major Alarm No Alarm Nominal
Minor Alarm No Alarm Nominal
InnerHTML representation is something like this ...
tr[1] ---> td[1] td[2] td[3]
tr[2] ---> td[1] td[2] td[3]
tr[3] ---> td[1] td[2] td[3]
tr[4] ---> td[1] td[2] td[3]
tr[5] ---> td[1] td[2] td[3]
The above table is created by HTML Table like this ...
<table id="inventoryGrid1" class="table table-striped table-bordered dataTable no-footer" role="grid" style="width: 408px;">
<thead>
<tbody>
<tr class="odd" role="row">
<td>Output Voltage</td>
<td>95.0 VAC</td>
<td>
<img src="../img/led/led_green.png">
<span> Nominal </span>
</td>
</tr>
<tr class="even" role="row">
<td>PS Input Voltage</td>
<td>135.0 VAC</td>
<td>
</tr>
<tr class="odd" role="row">
<td>Inverter Status</td>
<td>Off</td>
<td>
</tr>
<tr class="even" role="row">
<tr class="odd" role="row">
</tbody>
</table>
The Full xpath is ...
/html/body/div[2]/div/div/div/div[2]/div[2]/div/div/div/div[1]/div[1]/div/table/tbody/tr[1]/td[2]
I need to know ...
I can't assign:
row2col3 = drv.find_element_by_xpath("/html/body/div[2]/div/div/div/div[2]/div[2]/div/div/div/div[1]/div[1]/div/table/tbody/tr[2]/td[3]") # attempting to assign a variable to element in the table( row 2 column 3) which is "Nominal"Throws error: as 'list' object has no attribute ... Is it displaying that td tag name is a list ? and hence can't assign to a single variable ? Anyways, I am suppose to use row2col3 = drv.find_elements_by_xpath("/html/body/div[2]/div/div/div/div[2]/div[2]/div/div/div/div[1]/div[1]/div/table/tbody/tr[2]/td[3]") in order to get it working !
If I use the row2col3 element I neither can use row2col3.text nor row2col3.get_attribute("innerHTML"). So how do I get this ? Is it even possible ?
How do I read out row2col3 particularly from the table ? Please forgive me for the long xpath implementation command and the bad english and also the long msg... :)