More Xpaths functionality

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
shellster
Posts: 3
Joined: Thu Apr 07, 2011 5:13 pm

More Xpaths functionality

Post by shellster » Thu Apr 07, 2011 5:31 pm

First of all, I'd like to say that my company just purchased the scripting edition of iMacros and we were able to successfully leverage it to do a data migration to a new application. So, thanks guys for this wonderful tool.

During the migration, I ran into a problem. On one page, with a slow loading time, the javascript would not all get loaded before iMacros would start trying to run it's script. I tried all kinds of things, but never could find a good solution to the problem. WAIT SECONDS was too inefficient and too problematic to use, so I ended up using python to slam the last bit of data into the database in the background instead of using iMacros.

This finally gets me to my request/question:
One thing I continually wished I could check with iMacros is for the absence of an element or an element's visibility. For instance, in one place an ajax request would happen on the page load, and a "Loading..." would be displayed on the page in a div. I would have liked to have told iMacros to wait until that element was not visible anymore. I tried using XPaths, and could never find a way to check a css style setting in a way that iMacros would accept (though I could get it to work in both IE and Firefox).

First of all is there a way to do this using XPaths (I know that in some cases you could cheat by just using image matching on the page)?
Second, can you guys work on documenting exactly what XPath functionality iMacros supports?
Third, I would very much like to see the XPath functionality be expanded to support most XPath methods and advanced selectors. That would make it possible to handle almost any HTML scenario.
fastviper
Posts: 46
Joined: Tue Mar 15, 2011 1:30 pm

Re: More Xpaths functionality

Post by fastviper » Thu Apr 07, 2011 8:25 pm

Absence of element:
TAG (find an element) EXTRACT=TXT
if EXTRACT == #EANF#: ## iimLastExtract() IIRC
element not found

You may need to split macros into parts to do this.

Check out also XPATH addons for firefox - they more or less suffice together with element[@attribute], element[n] (n-th element), div[span='text in span'] and // (any path selector)
MattBell7
Posts: 627
Joined: Thu Nov 26, 2009 11:07 am
Location: United Kingdom

Re: More Xpaths functionality

Post by MattBell7 » Fri Apr 08, 2011 8:01 am

if you're using the scripting interface write a macro that selects the 'Loading' text, and loops continually until that script errors, after which it continues to the next macro.
shellster
Posts: 3
Joined: Thu Apr 07, 2011 5:13 pm

Re: More Xpaths functionality

Post by shellster » Thu Apr 14, 2011 1:35 pm

As to the comment about xpath's "add-ons" in Firefox, I found them to not be equivalent at all. When I was attempting to go that route in my migration, I used the xpath helper addon in Firefox. Three separate xpath's which worked in Firefox (I repeatedly checked them when iMacro's failed), didn't work in iMacros. Either I'm extraordinarily talented at finding weird ways to do fairly straightforward XPaths, or iMacros is far from having a complete Xpaths library.
Post Reply