Jump to content

Automating Internet Explorer


Guest jon13210
 Share

Recommended Posts

Guest jon13210

Hi...

I tried searching the forum for an answer and got reams of code, but no general info.

I need to automate a form submission in Internet Explorer. Basically launch the browser, find a text field, enter predefined text and hit submit..... and do it all on a scheduler.

I'm trying to create a poor man's scheduler to rotate content on a website without much automation on the backend controls.

My question is whether Autoit is the right solution for this. I don't wanna sit down and learn the scripting only to discover it's not what I need.

Also, any suggestions on resources or pre-built scripts I can start from and modify to my needs?

edit: Oh... and it'll need to authenticate into the form. that's doable... right?

Thanks.

Edited by jon13210
Link to comment
Share on other sites

Hi...

I tried searching the forum for an answer and got reams of code, but no general info.

I need to automate a form submission in Internet Explorer.  Basically launch the browser, find a text field, enter predefined text and hit submit..... and do it all on a scheduler.

I'm trying to create a poor man's scheduler to rotate content on a website without much automation on the backend controls.

My question is whether Autoit is the right solution for this.  I don't wanna sit down and learn the scripting only to discover it's not what I need.

Also, any suggestions on resources or pre-built scripts I can start from and modify to my needs?

Thanks.

<{POST_SNAPBACK}>

Not to be a spoilsport, but IE is notably craptacular when it comes to automation. Granted, I'm using AutoIt v3.1.0 (not the newest and definately not the Beta), so there may be additional functions in the COM version that works around IE's legendary stubbornness to extract information from it.

As far as form filling, if the form never changes, it's a simple "simulated human script."

Example:

Start IE and browse to form page.

Wait for title of page in the title bar.

Activate (give focus to) the main Edit window control.

Tab $x ammount of times

Enter standard info

Tab $x ammount to next field.

Enter info

.

.

.

Tab $x ammount of times to Submit button

Hit enter to submit form

Close IE

Start over.

Edit: Minor psuedocode clarification and corrected a typo.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

Hi...

I tried searching the forum for an answer and got reams of code, but no general info.

I need to automate a form submission in Internet Explorer.  Basically launch the browser, find a text field, enter predefined text and hit submit..... and do it all on a scheduler.

I'm trying to create a poor man's scheduler to rotate content on a website without much automation on the backend controls.

My question is whether Autoit is the right solution for this.  I don't wanna sit down and learn the scripting only to discover it's not what I need.

Also, any suggestions on resources or pre-built scripts I can start from and modify to my needs?

Thanks.

<{POST_SNAPBACK}>

Yes AutoIt can do what you are wanting to do. You will have to build the scheduler, and also the way in which it is to find the box and submit data.

The only thing about webpages is that they arent fully touchable by AutoIt which means you will have to either tab into the text box or use one of many methods we have come up with to interact with webpages. You could have AutoIt recreate the form (in HTML) and so long as it was posting to the same place you just know how many tabs it will take for what boxes and so on.

As far as pre-built scripts. There may be a scheduler and/or something similar to what you are wanting in the scripts and scraps forum.

Just search around a bit.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

I've only a VBS code:

Const URL = "http://office.freenet.de/e-tools.freenet.de/login.php3?world=frn_DE&callback=http://office.freenet.de/login/office.html?isfromid=99"
With WScript.CreateObject("InternetExplorer.Application")
  .Visible = True
  .Navigate URL
  Do Until .ReadyState = 4
  WScript.Sleep 50
  Loop
  With .document.forms("loginform")
    .username.value = "Your name"
    .password.value = "password"
    .submit
  End With
End With

This works for the given URL. If you want to use something like this you have to search the HTML code for the right inputboxes names.

Maybe there is a guy who can translate it to AutoIt. :(

Link to comment
Share on other sites

I've only a VBS code:

...

Maybe there is a guy who can translate it to AutoIt.  :(

<{POST_SNAPBACK}>

Converted into AutoIt3 script (note: Requires the latest AutoIt3 beta version 3.1.1.18):

Const $URL = "http://office.freenet.de/e-tools.freenet.de/login.php3?world=frn_DE&callback=http://office.freenet.de/login/office.html?isfromid=99"
$ObjIE=ObjCreate("InternetExplorer.Application")

With $ObjIE
  .Visible = True
  .Navigate($URL)
  Do
    Sleep(50)
  Until .ReadyState = 4
EndWith

With $ObjIE.document.forms("loginform")
  .username.value = "Your name"
  .password.value = "password"
  .submit
EndWith

Regards,

-Sven

Link to comment
Share on other sites

  • 3 weeks later...

The previous example benefited from a web page with named form elements. I wanted to do this with another page with generic (unnamed) form elements.

The documents object has a forms collection and forms on the page are sequentially numbered. Inside each form has an elements collection and they in turn are sequentially numbered. This example assumes that the first form on the page has Username and Password fields as its first two elements.

Hope this helps someone.

Dale

Const $URL = "http://your-location"
$ObjIE=ObjCreate("InternetExplorer.Application")

With $ObjIE
  .Visible = True
  .Navigate($URL)
  Do
    Sleep(50)
  Until .ReadyState = 4
EndWith

With $ObjIE.document.forms(0)
  .elements(0).value = "username"
  .elements(1).value = "password"
  .submit()
EndWith
Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

The script will need to be different for every webpage. You'll need to examine the HTML code of the page and make adjustments.

The last script I posted WOULD in fact work if it turned out that the FIRST <FORM> on the page included the USERNAME and PASSWORD fields and that the first two fields in that form were the username and password input boxes. If not, some minor adjustments should make it work, but again you'll need to get your hands dirty and examine the guts of the web page.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

  • 5 weeks later...

Did you try looking at the page source? A quick look shows that the fields are named... cardNumber and password. So, just change username to cardnumber in the vbs example and it should work.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...