0

I have been speculating on how to automate a process where I sign into a website but have only found a code so far that opens the site where I need to go. Is there a code where I can find the textbox, enter an email, hit next, (wait for the page to load, and enter a password and select next?

I am trying this out on google chrome through Powershell, Windows 10.

Here is what I have so far:

#opens to the site

$chrome = Start-Process -FilePath "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -ArgumentList "https://signin.absolute.com/Default.aspx?ReturnUrl=/SSO/SAML2/SSOService.aspx"

The next part has stumped me, I have one textbox where I want to put my email and click next. The HTML code looks like this, input name="ctl00$bodyContent$txtEmailAddress" id="txtEmailAddress" tabindex="1" class="form-control mb-2" type="text" placeholder="Enter your email address">

I have read that Invoke-webrequest could maybe do this, or Invoke-Restmethod, but I have either not understood or am not sure what it is that I can use.

Is there anything further I can try or look into?

Here is what I have tested so far:

$site = Invoke-WebRequest -uri "https://signin.absolute.com/Default.aspx?ReturnUrl=/SSO/SAML2/SSOService.aspx"

gets the info on the site $site | Get-Member

$site.Content

$site.inputfields

Inputfields? InputFields | select-object -Property "textfield"

#Site document.getelementbyid or tagname?

$site.document.getElementsByTagName('txtemailaddress') $element = $site.document.getElementsByTagName('txtemailaddress') $element.value = "myemail"

or ? $site.InputFields.Contains('id="divlogin"')

where-object? $emailElement = $inputs | where {$_.name -eq 'id="divlogin"'} if ($emailElement) { $emailElement.value = "myemail" }

Raye
  • 1
  • 1
  • Maybe this answer can help? https://stackoverflow.com/a/73676778/11954025 – Daniel Dec 20 '22 at 19:21
  • Brilliant. That helped me skip the need to writing out the code to somehow find the code I needed to work on. Great find! Thank you. – Raye Dec 20 '22 at 21:46

0 Answers0