Jump to content

IE click link by text


sudo
 Share

Recommended Posts

I am having a hard time determining why I can't use the _IELinkClickByText to have it execute a "click on link" function.

I've used the debug bar;

I see this for DOM :

<A class=sub_nav_off id=EnrolledCourses_WaldenEnrolledCourses1_enrolledSectionsList__ctl2_Hyperlink3 href="/psp/User/PlatformIntegrationPreProcessor.aspx?sessionkey=TransferUrl_7773252007112411" target=_blank>Go to your Classroom<BR></A>

The link href # changes at the end.

Can anyone point me in the right direction.

The script logs me into the site which takes me to another webpage, and this is where I'd like to click on the "Go to your Classroom" link

Thanks for any pointers.

Link to comment
Share on other sites

So you showed the HTML, but not the syntax of the function call you make in AutoIt... Can't help you troubleshoot unless you show what you tried.

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

Link to comment
Share on other sites

the click link func only clicks by the text. so just do this

_IElinkclickbytext ( $oIE, "Go to your Classroom"); this makes your script click the link you asked.

and be sure to define the func $oIE as the indow u are doing everything in

Edited by Regency
Link to comment
Share on other sites

Questions regarding the function define of $oIE. Does this object remain the same as long as I'm using the same instance of IE or does the object change for each webpage loaded within this instance of IE? Or am I just way off base?

Here is the code I'm working with:

I originally wanted to use the _IEClickbytext but it would just cycle through the rest of the autoit script and I was having a hard time trying to figure out where in the code it wasn't doing what I wanted.....beginners.... I guess we have to start somewhere.

Thanks for the replies

#include <IE.au3> 
$oIE = _IECreate("http://waldenu.edu/psp")
WinSetState("","",@SW_MAXIMIZE)
$var = StatusBarGetText ("Walden University - Online Application - Windows Internet Explorer", "Done", 1)
if $var = "Done" Then
Send("login")
Send("{tab}")
Sleep(100)
Send("password")
Send("{ENTER}")
winwait("PSP - Windows Internet Explorer", "", 5)
$var1 = StatusbarGetText ("PSP - Windows Internet Explorer", "Done", 1)
if $var1 = "Done" Then
    $oSubmit = _IEGetObjById ($oIE, "EnrolledCourses_WaldenEnrolledCourses1_enrolledSectionsList__ctl2_Hyperlink3")
    _IEAction ($oSubmit, "click")

WinWait("Course Home Page - Windows Internet Explorer", "", 5)
WinSetState("","",@SW_MAXIMIZE)
else 
    EndIf
else
    EndIf
Edited by sudo
Link to comment
Share on other sites

$oIE remains valid because it is a pointer to the browser rather than a particular page/document. It drills into the document for what it needs as appropriate -- this is part of what makes IE.au3 easier to use than interacting directly with the DOM.

I would suggest you use _IELoadWait to insure the page load is complete rather than the methods you are using... although by default, it is done for you on _IELinkClickByText, but not after _IEAction click.

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

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...