How to set style display of an html element in a selenium test? How to set style display of an html element in a selenium test? selenium selenium

How to set style display of an html element in a selenium test?


since you marked jQuery - You can use the css() function to set/get css attributes

$('#id_cv_upload').css('display','inline');


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

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

basically using driver.execute_script I am executing a java script for setting the style of an element.


$('#box').css({  background: "#FF0000",  "box-shadow": "1px 1px 5px 5px red",  width: "100px",  height: "100px",  display: "block"});

BSI.id().setStyle() vs jQuery.css() vs. native DOM