Jump to content

Clicking links, Possibilities, Need assistance


Recommended Posts

HI All,

Everything started well till I am getting a broken heart.

it start with this script doing wonderfully well until it started giving me a different part of the story. I supposed to open a page, login, navigate to few urls,

Posted Image

#include <IE.au3>
Local $oUser, $oPass, $oSubmit
Local $sUser = "maggot"
Local $sPass = "mangosuite"
Local $url = "http://www.imtalk.org"
Local $oIE = _IECreate($url, 1, 1, 0)
Local $selected = ""
Local $sLinks
Local $oLinks
Local $sMyString
_IELoadWait($oIE)
Local   $oInputs = _IETagNameGetCollection($oIE, "input")
for $oInput in $oInputs
    if $oInput.type = "text" And $oInput.name = "vb_login_username" Then $oUser = $oInput
    if $oInput.type = "password" And $oInput.name = "vb_login_password" Then $oPass = $oInput
    if $oInput.type = "image" And $oInput.value = "Log in" Then $oSubmit = $oInput
    if isObj($oUser) And isObj($oPass) And isObj($oSubmit) then exitloop
Next

$oUser.value = $sUser
$oPass.value = $sPass
_IEAction($oSubmit, "click")
_IELoadWait($oIE)
Sleep(500)
; _IENavigate ($oIE, "http://www.imtalk.org/cmps_index.php?pageid=IMT-Directory-Submitter",1)
_IENavigate ($oIE, "http://www.imtalk.org/modules/submitter/index.php?menu=submitter&fcaptcha=0&fpr=desc", 1)

$oFrame = _IEGetObjByName($oIE, "left")

$sMyString = "No Captcha, PR Desc.(714)"
_IELinkClickByText($oFrame, $oIE, $sMyString)

$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
    $sLinkText = _IEPropertyGet($oLink, "innerText")
    If StringInStr($sLinkText, $sMyString) Then
        _IEAction($oLink, "click")
        ExitLoop
    EndIf
Next

Posted Image

I started having problem in the link clicking part.

I started with trying to get the link from the $oFrame = _IEGetObjByName($oIE, "left")

so I can click inside that object; it proven unsuccessfull.

Posted Image

Posted Image

next I tried navigating the page to a new page. with this url

_IENavigate ($oIE, "http://www.imtalk.org/modules/submitter/index.php?menu=submitter&fcaptcha=0&fpr=desc", 1)

This leave out the frame in which it was located I still tried to navigate the link using the

Posted Image

_IELinkClickByText($oFrame, $oIE, $sMyString)

Posted Image

it also proven unsuccessful.

next I used the final method to loop and match the text link, it also still did not work.

i used the strinRegExp and StrinInstr both seems not working,

earlier, I also tried to select and post a form but unfortunately, teh form doesn't have a name I didn't know how to select and post the selected element.

Posted Image

I will be grateful if you can please give a hand.

Link to comment
Share on other sites

  • Moderators

This seems to work.

#AutoIt3Wrapper_UseX64 = n

#include <IE.au3>

Global $sUser = "", $sPass = ""
Global $sURL = "http://www.imtalk.org"

_IEErrorHandlerRegister()
Global $oIE = _IECreate($sURL, 0, 1)

$oForm = _IEFormGetCollection($oIE, 0)
$oUser = _IEFormElementGetObjByName($oForm, "vb_login_username")
$oPass = _IEFormElementGetObjByName($oForm, "vb_login_password")

_IEFormElementSetValue($oUser, $sUser)
_IEFormElementSetValue($oPass, $sPass)

_IEFormImageClick($oForm, "http://www.imtalk.org/images/styles/FunkyFresh/style/loginButton.gif")

_IENavigate($oIE, "http://www.imtalk.org/cmps_index.php?pageid=IMT-Directory-Submitter")

$oFrame = _IEFrameGetCollection($oIE, 4)
_IELoadWait($oFrame)
_IENavigate($oFrame, "http://www.imtalk.org/modules/submitter/index.php?menu=submitter&fcaptcha=0&fpr=desc")
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...