Remove the display:none attribute so that the item will be visible

Viewed 261

I need to remove the display:none attribute so that the item will be visible. It is similar to remove attribute display:none; so the item will be visible although I am using Powershell with Selenium.

The textarea Element is:

<textarea id="response" name="response" class="response" style="display: none;"></textarea>

I need to display this text area.

No luck with any of this commands:

$TextArea_Element.show()
$TextArea_Element.displayed.Clear()
$TextArea_Element.sendKeys("displayed".DELETE)

If I do a $TextArea_Element.displayed I get a value of "False"

Here is my Powershell code:

$browser = Start-SeChrome
$url = "somesite.com"
$browser.Navigate().GoToURL($url)

ForEach ($TextArea_Element in (Find-SeElement -Driver $browser -TagName TextArea))
{ 
  $TextArea_Element
  $TextArea_Element.displayed.Clear()
  #$TextArea_Element.sendKeys("displayed".DELETE)
}

Please help. Thanks

1 Answers

Try to edit the style of element to display='block'.

You can apply JavaScript to element as below:

$browser.ExecuteScript("arguments[0].style.display='block';", $TextArea_Element)
Related