2

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

Mathias R. Jessen
  • 157,619
  • 12
  • 148
  • 206
hdsouza
  • 354
  • 4
  • 17
  • It looks like the (ultimately Java) type that `Find-SeElement` (`Get-SeElement`) returns is of type [`RemoteWebElement`](https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/remote/RemoteWebElement.html) - and it doesn't look like it allows you to _modify_ the underlying HTML element. – mklement0 Oct 24 '20 at 18:01

1 Answers1

0

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)
Yun
  • 1,032
  • 7
  • 20