Jump to content
Macro Express Forums

Finding a text link to click on a web page. How?


HeyJim

Recommended Posts

I'm dusting off my old copy of ME3 Explained (the paperback) and preparing to make some new macros. I've been using the same dozen or so since 2005 and haven't had to do much of anything in the way of new macros in quite a while so this is going to be a bit of a stretch getting back to speed.

 

First problem: locating and clicking a text link on a browser page.

 

First off I remember that other than starting off in a browser window from the address bar and then maybe I TAB 14 times to get to suchandsuch a link to click there was no good way to locate that link on a page. Is there a better way? I mean, tab counts do change with minor page redesigns.

 

For instance, if we look at http://slashdot.org/. Upper right hand quadrant there is a link to "Create Account". What is the most direct and effective way to nail that link first time every time (to click it) and do so pretty much for any page and any text link? Doing a FIND doesn't do it and I remember that when I tried this a couple of years ago I gave up on there being a good way to do this. Just TAB "x" times and hope for the best.

 

There will be instances (such as with slashdot.org) where I'm allowed to go directly to the url that is generated by clicking that link. How then do I locate/enter text boxes on a web form? http://slashdot.org/login.pl?op=newuserform. How to easily enter the Nick Name box?

 

Any and all ideas on how to accomplish this will be greatly appreciated.

Link to comment
Share on other sites

Tabbing is usually the best and most reliable method in my experience. While 30-40 tabs would be tedious manually, ME handles such operations very quickly.

 

I usually find care is needed as I tab through a freshly-opened page to ensure I don't miss the cursor's appearance. For example, I did so the first time I tried your second example, locating the nickname box. In fact it takes a mere two tabs, as shown below. Note that this is an ME Pro macro, but the differences if any will be trivial. Also note that I use Firefox, so I have to add my own waiting sub-macro as the 'Wait for the webpage' command isn't supported.)

 

Web Site, "http://slashdot.org/login.pl?op=newuserform", using Default Web Browser

Macro Run: Wait for FF web page ready

Keystroke Speed: 20 milliseconds

Text Type (Simulate Keystrokes): <TAB><TAB>

Delay: 200 milliseconds

 

<WEB SITE URL="http://slashdot.org/login.pl?op=newuserform" Wait="FALSE" Default_Browser="TRUE" _IGNORE="0x000C"/>
<MACRO RUN Use_ID="FALSE" Name="Wait for FF web page ready" ID="-1" Wait="TRUE"/>
<KEYSTROKE SPEED Delay="20"/>
<TEXT TYPE Action="0" Text="<TAB><TAB>"/>
<DELAY Flags="\x02" Time="200"/>

 

An alternative technique is based on unique pixel colours, But that's not only more complex but also can be very slow. And it's just as exposed as the tab technique to changes in web page layout.

 

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...