Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (19.7k points)

I get an element like

cv_upload = driver.find_element_by_id('id_cv_upload')

So I want to set its display as inline in python itself.is it possible with python to set the display. I tried

cv_upload.style.display = "inline"

which is showing me an error.

One way which is getting into my mind is to use Jquery to change the display and then execute it using the driver.execute but unfortunately, I am not getting the right syntax to do this. Let me know how to do this (The syntax.) Thanks.

1 Answer

0 votes
by (62.9k points)

Finally find out the way to set display of an element.

driver.execute_script("document.getElementById('id_cv_upload').style.display='block';")

Basically by using a JavaScript code driver.execute_script helps in setting the style of an element.

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s Selenium online training!

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...