0

I have a page where I can't click on a button with selenium the html look like this before clicking into button: enter image description here

And that's how is look like after pressing the button: enter image description here

Is have a way to insert that values into the html tag to get visibility of the element I want in the case button.I try with WebDriverWait and ActionChains but no success.

I execute the javascript code:

driver.execute_script('document.getElementsByTagName("html")[0].setAttribute("data-whatelement", "button")')
driver.execute_script('document.getElementsByTagName("html")[0].setAttribute("data-whatclasses", "Button__StyledButton-iESSlv,dJJJCD Button-dtUzzq kHUYTy")')

And still the button element is not visible.How can I get the element try with EC wait and action chain.Is it timeout exception.Any advice.

dias2020
  • 21
  • 6

1 Answers1

0

Using execute_script you can run javascript and manipulate the DOM at will. See: Running javascript in Selenium using Python

So, for example (I'm not entirely sure what you need to do to get visibility of the element), to re-insert the data-inq-observer attribute into the body tag:

driver.execute_script('document.getElementByTagName("body").setAttribute("data-inq-observer", "1")')
ben
  • 385
  • 3
  • 11