selenium python could not get text of tbody's element

94 Views Asked by At

I have a python code that takes fake mail - sign up a website - then need to enter the code

I use this temp mail service -> mohmal.com

the inspect HTML is

<tbody><tr>
<td colspan="3" align="center" valign="middle" style="padding-bottom:20px;">
<table cellpadding="0" cellspacing="0" border="0" class="container" style="width:96%;">
<tbody><tr>
<td style="font-size:14px; line-height:16px;">
Mr. Smith,
<br> some text
<br> some text
<br> some text
<br><br><b>614126</b><br> 
<br> some text
<br> some text
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>

I need the 614126 verification code,

my python code is;

theCode = ""
a = driver.find_element_by_css_selector("body > table > tbody > tr > td > table:nth-child(2) > tbody > tr > td > table > tbody > tr > td > b")
theCode = a.text
print(theCode )

it gives me nothing, I tried

https://www.guru99.com/selenium-webtable.html

these methods, but it didn't work

EDIT 1:

the x path the code from insect is like this;

/html/body/table/tbody/tr/td/table[2]/tbody/tr/td/table/tbody/tr/td/b
0

There are 0 best solutions below