Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Powershell- Can't set Textarea.

$
0
0

I'm looking at a web page with a text area:

<textarea aria-label="Add comment" class="form-control" cols="0" maxlength="100000" name="text" rows="0" tabindex="0" aria-required="true"></textarea>

I want to set value of the textaea, however in doing so I am getting error :-

Error Details :- Exception setting "value": "The property 'value' cannot be found on this object. Verify that the property exists and can be set.

Could anyone please help me in setting value of textarea.

I am using the below code for setting value of textarea.

$AddCommentBtn = $ie.document.getElementsByTagName("section") | where {$_.className -eq "modal fade modal-addnote in"}
    $textareavalue=$AddCommentBtn.getElementsByTagName('textarea')

$textareavalue.value='Test'

Below is my script :-

$ie = New-Object -ComObject 'internetExplorer.Application'
$ie.Visible= $true # Make it visible

$username=""

$password=""

$ie.Navigate("to some web-page")

While ($ie.Busy -eq $true) {Start-Sleep -Seconds 3;}

$usernamefield = $ie.document.getElementByID('Username')
$usernamefield.value = "$username"

$passwordfield = $ie.document.getElementByID('Password')
$passwordfield.value = "$password"

$Link = $ie.document.getElementByID('submit-signin-local')
$Link.click()

While ($ie.Busy -eq $true) {Start-Sleep -Seconds 3;}

$ie.Navigate("to some form")
While ($ie.Busy -eq $true) {Start-Sleep -Seconds 10;}

$description = 'Test Description'
$descriptionfield = $ie.document.getElementByID('description')
$descriptionfield.value = "$description"

$AddCommentBtn = $ie.document.getElementsByTagName("section") | where {$_.className -eq "modal fade modal-addnote in"}
$textareavalue=$AddCommentBtn.getElementsByTagName('textarea')
$textareavalue.value='Test'

#InsertButton
$Link = $ie.document.getElementByID('InsertButton')
$Link.click()
$ie.Quit()

Thanks in Advance.




Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>