0

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';");
0

Your locator would fetch the first div, of id = 100.

Try the following:

document.querySelector('#200 p').innerText='welcome';
  • thanks it works , – mtesta010 Jun 15 at 11:46
  • what if I want to use class name 'abc'?? – mtesta010 Jun 15 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.