BrandonTerry Posted March 16, 2016 Report Share Posted March 16, 2016 Good day! Our company works with several websites--2 in particular--that require us to click various navigational links. Usually, I can create a macro to use CTRL F, type what is needed to search, and CTRL ENTER to actually click the link. However, in the case of these 2 websites, all links say the same statement and the color does not change when the links are clicked. Would their be a way to create a macro that would go to a hyperlink based on the javascript code? If this link has this ID in the code, then this...? Thank you in advance! Brandon Quote Link to comment Share on other sites More sharing options...
acantor Posted March 17, 2016 Report Share Posted March 17, 2016 A simpler approach may be to search for text near the link or field you are trying to get to. Then tab or shift+tab to your target. Maybe something like this (in pseudo code) Text Type "<CONTROL>f" ' initiate search Text Type "Personal Info" ' search for this text Text Type "<ESC>" ' cancel the search Repeat 10 Times ' navigate to the 10th screen object Text Type "<TAB>" Repeat End Quote Link to comment Share on other sites More sharing options...
BrandonTerry Posted March 20, 2016 Author Report Share Posted March 20, 2016 Hi, Alan! Thanks for the quick response! Unfortunately, this will not work. The website is a state employment website that contains a list of all clients we represent. The first column contains the hyperlinks with the same phrase--Work on this Employer. The column next to it contains the corresponding company EIN's. I've tried your suggestion prior to posting. Unfortunately, when I manually press ESC, it skips all "Work on this Employer" links. It's a crazy website that, unfortunately, 2 states use! Quote Link to comment Share on other sites More sharing options...
acantor Posted March 23, 2016 Report Share Posted March 23, 2016 Macro-powered workarounds for navigating poorly-coded web pages are often possible; but it takes effort to figure them out. Here are some methods I have used: 1. Check the code to see if the developers included accesskey attributes. For example, view the HTML for this site: http://directory.utoronto.ca/phonebook/pages/admin/main.xhtml ...and you will discover "1" and "2" are access keys for two fields. To navigate to the "Last Name" field in IE, press Alt + 1, or in Firefox, press Shift + Alt + 1. 2. Through trial and error experimentation, see if there are areas of the screen that, when clicked on, reliably move keyboard focus to a nearby screen object. In other words, click at (x, y), and then press Tab to move to certain fields. These "neutral areas" can sometimes be found in the margins of a page, e.g., pixel (1,1) as measured from the top left corner of the viewport. These actions can be translated into MEP scripts. 3. See if you can navigate to the target field by pressing Tab (or Shift + Tab) enough times. Something like this might work: Repeat 44 Type <Tab> ...or maybe Repeat 44 times Type <Tab> Wait 20 milliseconds (a delay may help with reliablity) 4. Press F6 (or Shift + F6) to move from frame to frame. 5. Combinations of the above... for example... Move mouse relative to the text cursor position (which in some browsers, is the upper left corner of the viewport). Move mouse (1, 1) relative to the last position (to get to a "neutral area") Mouse Click Type <F6><F6> (to move to the third frame) Type <Tab> 40 times (to reach the desired field) Quote Link to comment Share on other sites More sharing options...
Samrae Posted March 23, 2016 Report Share Posted March 23, 2016 Here are two more to consider along with Alan's great suggestions: 6. Change the size of the browser window to allow reliable positioning of elements in the browser. Then use mouse clicks on known locations. If necessary, you can save the size of the window at the top of the macro and restore it at the end. 7. Alan mentioned using <SHIFT><TAB> (back tab). I have found that in some cases this can be more reliable rather than tabbing forward through the fields in the browser window. Something like this: Text Type: <ALTD>d<ALTU> // Move to the address field of the browser Repeat Start (Repeat 44 times) Text Type: <SHIFTD><TAB><SHIFTU> // back tab Repeat End Quote Link to comment Share on other sites More sharing options...
acantor Posted March 25, 2016 Report Share Posted March 25, 2016 8. In some (but not all) web-based apps, the URL changes to reflect where you are. For example, for a webmail program, you might see URLs like these: Inbox folder: https:// xxxxxxxxx?id=123&page=1&inbox Sent messages: https:// xxxxxxxxx?id=123&page=1&sent Junk folder: https:// xxxxxxxxx?id=123&page=1&junk So rather than script a macro that clicks on the Inbox link, achieve the same thing by typing the URL in the address bar: Text Type: <ALT>d // Move to the address field of the browser Text Type: https://www.xxxxxxxxx?id=123&page=1&inbox Text Type: <ENTER> Quote Link to comment Share on other sites More sharing options...
BrandonTerry Posted May 11, 2016 Author Report Share Posted May 11, 2016 Thanks to everyone that has applied! I've asked the state office to actually put the hyperlinks on the codes instead of the generic instruction of "work on this employer." Not sure how long it will be before that happens or if it will happen though. I wonder if it would be possible to program a macro to open a link based on the link ID value. If this link has an ID of 1234, then this... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.