Jump to content

Text field on a web page


Recommended Posts

Looking for someone to stir my imagination!

I'm trying to select a text field on a web page. The problem is it could move posotion depending on if the fields above it wrap to become multi-line. Currently i'm searching on a pixel color (using the following) with some success, but no scientific accuracy!

$coord=PixelSearch(450,650,460,685,0xB7CCE3)
        if isarray($coord) then
            mouseclick("main",$coord[0],$coord[1]-20,1)
        Else
            msgbox(0,"Fail","pixel not found")
            exit
        endif

Window info doesn't give me much help as the contol has nothing specific that I can code to.

Any ideas?

[font="Comic Sans MS"]"I'm not usually a praying man, but if you are up there, please save me Superman!" (Homer J. Simpson)[/font]
Link to comment
Share on other sites

If you were to use the IE.au3 UDFs functions, which are included in the autoit3 download, you will get much better results.

For instance, the field you mention may change slight postion but its unlikely to change its name, and you can select it by its name.

There is also a similar UDF for firefox FF.au3.

It may take you a little while to get the hang of, but a few forum searches will have you started in no time and you will have a much more reliable method of achieving your goal than pixelsearching.

EDIT: I think the add on for firefox to inspect the webpage is called firebug.

Off the top of my head I cannot remember what is used for IE, but nevertheless the field and object names remain the same.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Brilliant - thanks for the reply - it sets me off in a direction now... :idea:

Edited by gfcaim
[font="Comic Sans MS"]"I'm not usually a praying man, but if you are up there, please save me Superman!" (Homer J. Simpson)[/font]
Link to comment
Share on other sites

Sorry to continue this, but I have been doing some searching/reading on this and still don't get how to get the element names - could someone please give me a pointer in th eright direction to a simple tutorial...

[font="Comic Sans MS"]"I'm not usually a praying man, but if you are up there, please save me Superman!" (Homer J. Simpson)[/font]
Link to comment
Share on other sites

what browser do you use ?

Try Using DebugBar For IE

Or search Firefox addons for FireBug

When you install firebug addon, when you right click you will see a shell option for inspect element, for whichever you have the mouse over.

Not sure how it works in DebugBar

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Heres a quick simple example of what you will need to be doing.

#include <IE.au3>

$oIE = _IECreate("www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oSearch = _IEFormElementGetObjByName ($oForm, "q")
$oSubmit = _IEFormElementSetValue ($oSearch, "Autoit3")
_IEFormSubmit ($oForm)

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Thanks so much John, I will go try to learn now! (BTW I'm using IE, not through choice but Corporate decision)

[font="Comic Sans MS"]"I'm not usually a praying man, but if you are up there, please save me Superman!" (Homer J. Simpson)[/font]
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...