INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

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

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

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

(OP)
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("http://page.com")
$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

Quote:


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...

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

(OP)
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(“http://www.google.com”)
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:

Quote:

getElementById(“q”)

?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close