Sign in to follow this  
Followers 0
tonyrocks

How to click a SPAN link with no text

4 posts in this topic

I'm in the process of writing a script that clicks on the first link in a list, which brings up another pop-up and then closes that pop up.  The previous first link disappears and is replaced with the next in line...repeat process.

My problem is this, I cannot seem to figure out how to click the link, which contains no text, but appears to be using some css to display an image.  Below is the example row with a link:

<div class="action"><a class="button-small" href="#"><span class="category system"></span></a></div>

I'm thinking I could use something with _IELinkClickByText($oIE, "#") ...but not sure.

Thanks!

-Tony

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Use the _IE function to grab all span, then loop through, and match off the class attribute:

_IETagNameGetCollection
For $oNode In $oNodes
Consolewrite($oNode.className() & @crlf)
NExt
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Ok, so what i did was just add some text (zap...yeah, very creative, i know).  And used the:

_IELinkClickByText($oIE, "zap")

This works and brings up a dynamically generated pop-up (div, not javasript alert).  I want to then click a link on that pop-up that says "Accept."  Clicking that link disposes of that pop-up.  However I this doesn't work:#

 
#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IECreate("http://localhost/myapp")

; Display messages
_IELinkClickByText($oIE, "zap")

;wait
_IELoadWait ($oIE, 20, 3000)

;Click the accept button on pop-up. After clicking Accept, the pop-up goes away
_IELinkClickByText($oIE, "Accept")

It doesn't seem to know how to click Accept.  Am I missing something? 

Edited by tonyrocks

Share this post


Link to post
Share on other sites

This might be just my sleeping brain talking, but didn't you say that the Accept link is in a pop-up? doesn't that mean that _IELinkClickByText($oIE, "Accept") is trying to click a link called Accept on the 1st page and not the pop-up itself?

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