How to remove an attribute from an element in selenium


New member

<textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" 
style="width: 250px; height: 40px; border: 1px solid rgb(193, 193, 193); margin: 10px 25px; padding: 
0px; resize: none; display: none;"></textarea>

i'm trying to remove the "display: none" attribute, how would I go about doing this in the python version of selenium?


New member
You can do as per below 2 methods

String visibility = web.findElement(By.xpath("//your xpath")).getCssValue("display");

You will get display value and then you can remove it. other way to do it using below code.
firefox = webdriver.Firefox()
element = firefox.find_element_by_css_selector("this element css selector here")
attributeValue = element.get_attribute("style")

Style element you will get and remove display from it.