0

This is my url

https://webmail.fasttrackteam.com/Login.aspx

I am able to open this path in IE. but unable to set loginid & password. Also dont know how to fire click event.

following is code that I have tried.

$ie = New-Object -com InternetExplorer.Application
$ie.Navigate("https://webmail.fasttrackteam.com/Login.aspx")
$ie.visible = $true


$doc = $ie.document
$user = $doc.getElementById("ctl00_MPH_txtUserName")
$password = $doc.getElementById("ctl00_MPH_txtPassword")
$submit = $doc.getElementById("ctl00_MPH_btnEnterClick")

$user.value = "emailid"
$password.value = "password"
$submit.Click();

$ie.Quit();

$ie.Document.body | Out-File -FilePath C:\Users\amol.kshirsagar\Documents\FastTrack\Work\Extra\AutoLogin\log.txt

EDIT

This is error that I am getting,

You cannot call a method on a null-valued expression.

1 Answer 1

1

You call the Quit() method before accessing the Document.body member. As the Quit() call, well, quits the application, don't you think it should be somewhat peculiar to access its data afterwards?

Try accessing the member first, then quitting the browser instance.

Sign up to request clarification or add additional context in comments.

Comments

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.