Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
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!

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...