How to change values in element.style python selenium?

0

Issue

value i want to change

The webpage is the following.

It has to go on mobile. I want to change the value of 'animation-duration' under
id 'optionContainer'.

It seems like it’s attached to the website or something

I tried:

driver.execute_script("document.getElementById('optionContainer').style.animated.animation-duration = '.05s';")

Any suggestions?

Solution

Quite simple. Write animationDuration instead of animation-duration, that would raise a syntax error in Javascript.
And also better get the element directly by its class.

 driver.execute_script("document.getElementByClassName('animated').style.animationDuration = '.05s';")

Answered By – ext

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More