I am try to change non input attribute value in Firefox frame in the format:
<div id='100' class='abc'>
<p> hello </p>
</div>
<div id='200' class='abc'>
<p> hello 2 </p>
</div>
.....
I want to change hello 2 to welcome I try this code but it does not work
driver.execute_script("document.getElementsByClassName('abc')[0].text='welcome';");
João Farias
11.2k2 gold badges21 silver badges41 bronze badges
1 Answer 1
Your locator would fetch the first div, of id = 100.
Try the following:
document.querySelector('#200 p').innerText='welcome';
answered Jun 15, 2019 at 9:02