Sign in to follow this  
Followers 0
autoit2008

IE, clicking on next page?

3 posts in this topic

I want to automate IE, after submitting a value on the first page, and cilck on some link on the next page after the submission.

Here is my code:

#include <IE.au3>

#include <Debug.au3>

_DebugSetup ("Google-click next")

$oIE = _IECreate("http://www.google.com")

_DebugOut ("Start....")

$o_form = _IEFormGetObjByName($oIE, "f")

$o_q = _IEFormElementGetObjByName($o_form, "q")

$o_submit = _IEFormElementGetObjByName($o_form, "btnG")

_IEFormElementSetValue($o_q, "test")

_IEAction($o_submit, "click")

_DebugOut("next page");

$sMyString = "Next"

$oLinks = _IELinkGetCollection($oIE)

For $oLink in $oLinks

$sLinkText = _IEPropertyGet($oLink, "innertext")

If StringInStr($sLinkText, $sMyString) Then

_IEAction($oLink, "click")

ExitLoop

EndIf

Next

_DebugOut ("End....")

The initial form submission works, but it doesn't click on the next page. For clicking next page, I tried with this also:

_IELinkClickByText($oIE, "Next", 1)

But still doesn't work. Does anyone know why?

Thanks!

Share this post


Link to post
Share on other sites

The initial form submission works, but it doesn't click on the next page. For clicking next page, I tried with this also:

_IELinkClickByText($oIE, "Next", 1)

But still doesn't work. Does anyone know why?

Thanks!

#include <IE.au3>
;~ #include <Debug.au3>

;~ _DebugSetup ("Google-click next")

$oIE = _IECreate("http://www.google.com")
;~ _DebugOut ("Start....")

$o_form = _IEFormGetObjByName($oIE, "f")
$o_q = _IEFormElementGetObjByName($o_form, "q")
$o_submit = _IEFormElementGetObjByName($o_form, "btnG")

_IEFormElementSetValue($o_q, "test")
_IEAction($o_submit, "click")

;~ _DebugOut("next page");
;~ $sMyString = "Next"
;~ $oLinks = _IELinkGetCollection($oIE)
;~ For $oLink in $oLinks
;~ $sLinkText = _IEPropertyGet($oLink, "innertext")
;~ If StringInStr($sLinkText, $sMyString) Then
;~ _IEAction($oLink, "click")
;~ ExitLoop
;~ EndIf
;~ Next

;~ _DebugOut ("End....")


;~ The initial form submission works, but it doesn't click on the next page. For clicking next page, I tried with this also:
_IELoadWait ($oIE)
_IELinkClickByText($oIE, "Next")

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Thanks! It works very well now. ;)

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