Jump to content

Accessing HTML form in loaded page


 Share

Recommended Posts

You could try the IE Automation UDF Library. You'll need the beta version of AutoIt to use it. See Post 3 in the IE Automation thread for some examples and quite a few others scattered throughout the forums.

Dale

Hi folks?

Is there any way to send keystrokes to a form which reside in a loaded HTML page or generally webpage?

For example : I want to send a sentence to one filed of a webpage from autoit? How can I do that?

Thanx in advance ;)

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

I use the beta exclusively. When there is trouble with the beta versions (which is rare) it is typically with the newest functionality that is available only in the beta. The COM support has been in the beta for months now and is pretty solid.

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

  • 3 weeks later...

Hi Dale,

I found Internet Explorer Automation UDF Library very useful, but I couldn't manage to

do automation tasks on an already opened browser window. Imagine there is

opened browser window containg some forms, so how can I force AutoIt to type in

forms. Every IE Automation UDFs needs an object to be created and those are useful

when we want to start from first. What is the solution for this situation?

Thanks in advance. ;)

The more I learn the less I know!

Link to comment
Share on other sites

Hi

I know how to do that. My question is how can I do automation on a page which is not opened by autoit and opened by User. As you know every automation examples provided here at the forum first Open browser or navigate to somewhere first, I want to skip this steps and directly send keystrokes or commands to an already opened webpage.

thanks.

The more I learn the less I know!

Link to comment
Share on other sites

Well, how might you go about filling out this form if you're not able to click items based on what they look like? Obviously AutoIt can't read a webpage in the same way that a human does, so a different approach is needed.

Generally when you load a page, it will take a certain number of Tab presses to reach the desired element of the page. Although it's not an ideal solution, you could send this number of Tabs to the browser and then assume that the cursor has reached the first element of the form. You could then Send() a series of keystrokes to fill out the field, Send() another tab and then repeat until all of the fields are completed and the Submit button has the focus.

Link to comment
Share on other sites

Thank you Lxp.

So it means there is no possibilty in current version to get elements of an opened documet to return an array...Is there any chance to implement it by AutoIt developers in future versions?

Edited by silvercover

The more I learn the less I know!

Link to comment
Share on other sites

Take a look at the _IEAttach function -- it gives you a reference to an existing IE brwser window and then you can do anything you could have done with _IECreate

Dale

Hi Dale,

I found Internet Explorer Automation UDF Library very useful, but I couldn't manage to

do automation tasks on an already opened browser window. Imagine there is

opened browser window containg some forms, so how can I force AutoIt to type in

forms. Every IE Automation UDFs needs an object to be created and those are useful

when we want to start from first. What is the solution for this situation?

Thanks in advance. ;)

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

OK,

$oIE = _IEAttach("www.mail.yahoo.com", "url")

Take a look at the function header to see the parameter description and the func statement to see that Title is the default.

;===================
;
; Function Name:    _IEAttach()
; Description:      Attach to the first existing instance of Internet Explorer where the search string sub-string matches
;                   based on the mode selected.
; Parameter(s):     $s_string   - String to search for
;                   $s_mode     - Search Mode, match substring in Title, URL, body Text or body HTML
; Requirement(s):   AutoIt3 Beta with COM support (post 3.1.1)
; Return Value(s):  On Success  - Returns an object variable pointing to the IE Window Object
;                  On Failure   - 0  and sets @ERROR = 1 on no match and @ERROR = 99 on invalid Mode
; Author(s):        Dale Hohm
;
;===================
;
Func _IEAttach($s_string, $s_mode = "Title")

Dale

Hi dale,

Could you please give an example on how to use _IEAttach function for yahoo login page :

www.mail.yahoo.com

Thanks.

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

That's ok, butwhen I want to use _IEFormElementGetObjByName or _IEFormGetObjByName after _IEAttach AutoIt gives me an error saying:

Error: Variable must be of type "Object".

Thanks anyway.

Edited by silvercover

The more I learn the less I know!

Link to comment
Share on other sites

I just looked at the page and you are likely having trouble because www.mail.yahoo.com is not the real URL -- it redirects to http://mail.yahoo.com (so the www.mail.yahoo.com url will not match). Instead use:

$oIE = _IEAttach("mail.yahoo.com", "url")

You could also match on title like this:

$oIE = _IEAttach("Sign in to Yahoo!")

Dale

That's ok, butwhen I want to use _IEFormElementGetObjByName or _IEFormGetObjByName after _IEAttach AutoIt gives me an error saying:

Error: Variable must be of type "Object".

Thanks anyway.

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

Sorry - they don't expose a COM object model.

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

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