Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to open HTML page, insert login and password and click login

Status
Not open for further replies.

Leosy

Technical User
Apr 13, 2012
49
0
0
PL
Hello guys.

Is it possible to open html page than insert login and pass and than click "connect", than after login "remember" html code in some txt file ?

I found some code

Code:
$ie = New-Object -com "InternetExplorer.Application"
$ie.Navigate("[URL unfurl="true"]http://page.com")[/URL]
$ie.visible = $true

do { sleep 5 }
while ( $ie.busy )

$doc = $ie.document
$user = $doc.getElementById("A1594987279")
$password = $doc.getElementById("A1123735963")
$submit = $doc.getElementById("Connexion")

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

$ie.Quit();

I found in html code ID for user, pass, and "login" button

But it doesn;t work...
What can be wrong ?

Error
PS U:\> $user.value = "kolos"
Property 'value' cannot be found on this object; make sure it exists and is settable.
At line:1 char:7
+ $user. <<<< value = "kolos"
+ CategoryInfo : InvalidOperation: (value:String) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound

PS U:\> $password.value = "lolos"
Property 'value' cannot be found on this object; make sure it exists and is settable.
At line:1 char:11
+ $password. <<<< value = "lolos"
+ CategoryInfo : InvalidOperation: (value:String) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound

PS U:\> $submit.Click();
You cannot call a method on a null-valued expression.
At line:1 char:14
+ $submit.Click <<<< ();
+ CategoryInfo : InvalidOperation: (Click:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull


Thanks for any help and clue...
 
I've started with something simplier. I've started to learn PS. Found some code:
So inserting "string" in google and submit

Code:
$IE= new-object -com InternetExplorer.Application
$IE.navigate2(“[URL unfurl="true"]http://www.google.com”)[/URL]
while ($IE.busy) {
sleep -milliseconds 50
}
$IE.visible=$true
$IE.Document.getElementById(“q”).value=”PowerShell”
$IE.Document.getElementById(“f”).submit()

what exactly do and what it's from:

getElementById(“q”)

?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top