Sign in to follow this  
Followers 0
silvercover

Accessing HTML form in loaded page

19 posts in this topic

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 ;)


The more I learn the less I know!

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

Thanks! ;)

As you said it is still in beta, how stable is that?


The more I learn the less I know!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

What's the webpage ? Or is there a webpage like it, we could show you the steps, and others can watch and learn too.


FootbaG

Share this post


Link to post
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!

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thanks Dale.

AutoIt Rocks.


The more I learn the less I know!

Share this post


Link to post
Share on other sites

Hi dale,

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

www.mail.yahoo.com

Thanks.


The more I learn the less I know!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

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!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thanks Dale. It works now.

Is there any chance to have these kinds of automation for other browsers such as Opera, Netscape and FireFox?


The more I learn the less I know!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Dale

dale, a while ago you posted a link to some documentation on all of the objects etc, and i'm not finding it with search. still have it handy?

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

dale, a while ago you posted a link to some documentation on all of the objects etc, and i'm not finding it with search. still have it handy?

disregard, i found it

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
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
Sign in to follow this  
Followers 0