Jump to content
Sign in to follow this  
muzle6074

_IELinkClickByText & Index not working!

Recommended Posts

muzle6074

Hi every1,

I think I posted in wrong forum b4 so here's my repost :)

I'm writting a script to go to 1 of my forums, click a few buttons, and add replys. The problem I'm having is that when I go to submit the post _IELinkClickByText or index wont work! Is there any other way I can click a button on a page?

I've been using IE builder to get the names of the form elements.

The submit post reply displays like so...

Index: 105

Tag: Input

Name: Submit

ID: Null

Extra Information: Forum Input Type: submit

Value: Post Reply

Regards.

#include <IE.au3>

Global $Paused
HotKeySet("{HOME}", "Post")
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{F10}", "Terminate")

While 1
    ToolTip('Ready! -- Controls: Home(run), Pause(pause), F10(terminate)',0,0)
    Sleep(100)
WEnd

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('"Paused" -- Controls: Home(run), Pause(pause), F10(terminate)',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Post()
    ToolTip("")
    $o_IE = _IECreate("link here")
    While 1 
        _IENavigate($o_IE, "link here")
        _IELinkClickByText($o_IE, "Add Reply")
        $o_Form = _IEGetObjByName($o_IE, "Post")
        _IEFormElementSetValue($o_Form, "bump")
        _IELinkClickByText($o_IE, "Post Reply"); FAILS HERE (does not click button)
        Sleep(30000)
    WEnd
EndFunc

Func Terminate()
    Exit 0
EndFunc

Share this post


Link to post
Share on other sites
DaleHohm

Only some of the things you can click on on a webpage are "links". Links have an HTML tag <A> (or they can be image maps, but don't worry about that now).

The element you describe is a form INPUT element and not a link. Please see the examples for the _IEForm* functions for more help.

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
muzle6074

Thank you for your input Dale! I will give this another go tonight when I get home and post back if I'm still having troubles :)

Regards

Share this post


Link to post
Share on other sites
muzle6074

I'm still having problems getting my script to click this link! :)

I tried using this method:

$o_Post = _IEGetObjByName($o_IE, "Post")
            $o_Form = _IEGetObjByName($o_IE, "Post Reply")
            _IEFormElementSetValue($o_Post, "bump")
            _IEFormSubmit($o_Form)

But it failed :)

I've also tried some other ways like _IEFormSubmit($o_Post)

In the help file you can click via a link, index, or img, but this button is appearing in IE builder as an input. Really need some help!

EDIT: Other things I've tried...

$o_Reply = _IEFormGetObjByName($o_IE, "submit")
            _IEFormSubmit($o_Reply)

Regards.

Edited by muzle6074

Share this post


Link to post
Share on other sites
PsaltyDS

I'm still having problems getting my script to click this link! :)

I tried using this method:

$o_Post = _IEGetObjByName($o_IE, "Post")
            $o_Form = _IEGetObjByName($o_IE, "Post Reply")
            _IEFormElementSetValue($o_Post, "bump")
            _IEFormSubmit($o_Form)

But it failed :)

I've also tried some other ways like _IEFormSubmit($o_Post)

In the help file you can click via a link, index, or img, but this button is appearing in IE builder as an input. Really need some help!

EDIT: Other things I've tried...

$o_Reply = _IEFormGetObjByName($o_IE, "submit")
            _IEFormSubmit($o_Reply)

Regards.

This is getting confusing to me. In your first post you had "Name: Submit", in this post you have "Post", "Post Reply", and "submit". Is the "Post" element inside the "Post Reply" form? Are any of these names getting you valid objects for Forms or Elements in the page? Is there also a form called "submit"? Add _IEErrorHandlerRegister () to the top of your IE section and watch the SciTE console output to see if your references are valid. Note that _IEFormGetObjByName() returns the object reference to the form itself, not an element in the form (that would be _IEFormElementGetObjByName()).

Also, read the help file under _IEFormSubmit(), especially the Remarks section and note the various different techniques listed in the examples there.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
muzle6074

Hi PsaltyDS,

The above code was me just trying all sorts of things because I really can't find out how to click a stupid button! I've been trying 2 days now and it's the only thing stopping me from finishing the script :)

The only form found on the page is called "REPLIER" so I tried the following code...

$submit = _IEFormElementGetObjByName($o_IE, "REPLIER")
            _IEFormSubmit($submit)

The console outputs...

--> IE.au3 V2.3-1 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidObjectType

--> IE.au3 V2.3-1 Error from function _IEFormSubmit, $_IEStatus_InvalidDataType

Edited by muzle6074

Share this post


Link to post
Share on other sites
muzle6074

Here's an image taken from IE builder, hope this can help you understand my problem!

Posted Image

Share this post


Link to post
Share on other sites
PsaltyDS

Hi PsaltyDS,

The above code was me just trying all sorts of things because I really can't find out how to click a stupid button! I've been trying 2 days now and it's the only thing stopping me from finishing the script :)

The only form found on the page is called "REPLIER" so I tried the following code...

$submit = _IEFormElementGetObjByName($o_IE, "REPLIER")
            _IEFormSubmit($submit)

The console outputs...

OK, you crossed them up again. You gave the name of form in the function for getting the element. Try this:
$oForm = _IEFormGetObjByName($o_IE, "REPLIER")
$oSubmit = _IEFormElementGetObjByName($oForm, "submit")
_IEAction($oSubmit, "click")

Now, as the help file for _IEFormSubmit() tells you, using action "click" might work, or may not be the best way for this form, but you should at least have the correct object references to experiment with.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
muzle6074

Thank you PsaltyDS! It works great, many thanks.

Regards.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.