0

I am trying to 1. Login to my webapp 2. Check for some new rows in a table tag

I have issues with the step 1.

$username = "admin" 
$password = "admin" 
$ie = New-Object -com InternetExplorer.Application 
$ie.visible = $false
$ie.navigate("https://somesite.com") 
while ($ie.ReadyState -ne 4) { start-sleep -m 100 } 
#start-sleep 10
$ie.document.getElementById("login-form-username").value = "$username" 
$ie.document.getElementById("login-form-password").value = "$password" 
$ie.document.getElementById("login").submit()
start-sleep 20 
$ie.Document.body | Out-File -FilePath c:\web.txt 

It opens IE11 and goes to the page. But when it comes to need to findById and input - there is an error: The property 'value' cannot be found on this object. Verify that the property exists and can be set my HTML input section is:

<input name="os_username" class="text medium-field" id="login-form-username" type="text">
10
  • can u post the url? Commented Sep 11, 2019 at 8:41
  • @EylM sorry I cant. It is a local url on my local server in a company. Commented Sep 11, 2019 at 9:08
  • Its hard to test it. is the element inside iframe? is it loaded dynamically by the javascript or it's part of the html source? Commented Sep 11, 2019 at 9:12
  • 1
    Could it be that there is another element with id="login-form-username" in your page? Commented Sep 11, 2019 at 9:45
  • 3
    Have you checked the HTML you posted? There is no element with id="login-form-username" in this document. Commented Sep 11, 2019 at 10:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.