jQuery

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

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
ark5041
Posts: 4
Joined: Wed Nov 04, 2009 2:12 pm

jQuery

Post by ark5041 » Wed Jan 27, 2010 5:53 pm

I had been wondering if it was possible to use jQuery through the iMacros interface. I searched the forum to see if anyone had a similar idea, and there actually were some comments about it. However, the benefits of using jQuery were not clearly articulated. So, I'm going to give it a shot.

If I'm using iMacros as a regression tester, many times there will be elements on the page which I would need to access properties of. So, I might need to access a certain cell in a table and compare it to another cell in a table. That's a simplified example, but I think it illustrates the picture. Or I might want to access certain text on the page or the property of a certain element which might not have an id.

To do this without jQuery or a similar framework is possible, but it creates ugly, unmaintainable code. jQuery's selection/traversing tools are incredible and they would be a really nice addition to the iMacros plugin.

So there's a recommendation for the future... now I'll ask a question...

I haven't seen any documentation on this, but if there is, please point me towards it... But what is the scoping of the javascript variables created by the iMacros plugin? Where is that javascript actually executed? And is it accessible by the page?

Thanks for a great product!
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: jQuery

Post by Daniel, Tech Support » Fri Feb 05, 2010 2:43 pm

Hello,

Sorry for coming back to you only so late. Actually, you raised a very interesting topic. Thank you for your suggestion!
Firstly to your question. Javascript in Firefox is executed in the XUL enviroment. The variables are not accessible by the page.
Now, JQuery can actually be loaded using a technique described here https://developer.mozilla.org/en/JavaSc ... de_modules. This isn't something we have really played with so far, so we would be very thankful for any feedback, if you go ahead with this.

By the way, you may find this interesting too: iMacros also supports XPath. Another interesting feature is that a URL in iMacros can also call Javascript functions that are either defined in this line or are embedded in the page:

Code: Select all

URL GOTO=javascript:alert("TEST")
More on that here.

Best regards,
Daniel, iOpus Support
ark5041
Posts: 4
Joined: Wed Nov 04, 2009 2:12 pm

Re: jQuery

Post by ark5041 » Mon Feb 08, 2010 8:31 pm

Hi Daniel,

I appreciate your reply to my post. And thanks again for a great product. I've been able to create a regression test which will literally save hundreds of man-hours every time it runs (only takes about an hour). I had actually got jQuery sort of working using the URL GOTO method you suggested. You can use a jQuery bookmarklet to load jQuery into any page. Something like this

Code: Select all

URL GOTO=var s=document.createElement('script');s.setAttribute('src','http://jquery.com/src/jquery-latest.js');document.getElementsByTagName('body')[0].appendChild(s);
The problem is, as you noted before, the javascript executed on the page does not seem to have the same scope as the javascript iMacros uses. I took a look at the link you posted, and honestly, I'm fairly new to firefox/development so it's a bit over my head.

I had another post which was turned into an internal dev ticket regarding imacros tracking the "live dom". If that is implemented, it would create a the following possible use case:
A) imacros javascript loads page in question
B) imacros url goto loads jquery
C) imacros url goto is used to manipulate webpage and figure out values in question
D) imacros url goto writes those values into the dom on the page
E) imacros javascript uses content.document.getElementById to get whatever values in question are


I would also encourage other members who may have more firefox development/javascript experience to play around this and post their findings as the potential here is enormous. I honestly believe that the value of iMacros would easily double with a native implementation of jQuery.

-andrew
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: jQuery

Post by Daniel, Tech Support » Tue Feb 09, 2010 12:21 pm

Hello Andrew,

Many thanks for your feedback in deed! I will send a link to this topic to our developers.
Yes, we would highly appreciate feedback from other members too!

Again, thank you very much for your interest and for your feedback!

Sincerely,
Daniel, iOpus Support
cknorr
Posts: 4
Joined: Tue Jul 20, 2010 8:28 pm

Re: jQuery

Post by cknorr » Tue Jul 20, 2010 8:48 pm

We are evaluating iMacros for purchase and have run into something of a show-stopper. We believe our problem is related to this topic, but I'm definitely a newbie so please go easy! :D

Our web application uses the mcDropdownjQuery Plug-in. When we attempt to playback a recording after selecting an item from this menu we get the following error:

RuntimeError: element LI specified by TXT:Last<SP>Month was not found, line: 5

Line 5 contains the following:

TAG POS=1 TYPE=LI ATTR=TXT:Last<SP>Month

A potentially acceptable workaround for us would be to modify this line to perhaps supply some type of 'hard-coded' value but I don't know if this is possible and, if so, what the syntax would be.

The other workaround (which would be preferred) would be to solve the problem using either the GOTO syntax or loading the code modules per the link Daniel provided. I'm really struggling here to understand the context. Basically, what needs to get loaded? Should the GOTO should be loading jQuery plug-in itself? Is this even a workaround to the real problem of scope that seems to be taking place?

I'm more than happy to give this a go and report back to the user community (hopefully with good news!) but really could use a push in the right direction.

MUCH thanks!

Chris
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: jQuery

Post by Daniel, Tech Support » Wed Jul 21, 2010 10:09 am

Hi Chris,

I think your issue is a bit different - you're not trying to use jQuery with iMacros, but you're trying to automate a website that uses jQuery. Is that correct?
By looking at your description I suspect it could be an AJAX related issue. Could you please give me a link to the website and short instruction on which menu needs to be automated?

Best regards,
Daniel, iOpus Support
cknorr
Posts: 4
Joined: Tue Jul 20, 2010 8:28 pm

Re: jQuery

Post by cknorr » Wed Jul 21, 2010 1:32 pm

Much thanks Daniel. You are 100% correct in your assessment of what we are trying to do.

I'm looking into seeing if we can get you onto our web site -- right now it's behind a firewall so that could be an obstacle. If you have anything you can suggest I'd be more than happy to give it a try. I'm a pretty experienced software developer -- just a newbie with iMacros.

Again, thanks a ton!

Chris
cknorr
Posts: 4
Joined: Tue Jul 20, 2010 8:28 pm

Re: jQuery

Post by cknorr » Wed Jul 21, 2010 1:59 pm

Daniel, I checked with our security folks. While I can't give you direct access to the site we could do a WebEx together and I can turn over the control to you. Is this something you can work with?

I appreciate your help -- as I say, we are definitely looking to purchase a web testing tool so we can automate with our automated TFS build/test platform.

Thanks again!

Chris
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: jQuery

Post by Daniel, Tech Support » Thu Jul 22, 2010 11:18 am

Hi Chris,

I am really sorry, but I can only do WebEx with existing customers. I am very sorry about that, but this is a policy we have to follow, as otherwise we would really be overloaded.
If you can think of any other website that has sort of a similar menu, but is public, I would gladly try to provide a solution for that.

If the issue is with AJAX, I would say it is best to use our DirectScreen technology, which is currently only supported in iMacros Browser and iMacros for Internet Explorer.

Let me give you an example for the drop-down list in Google:

Code: Select all

'Go to Google
URL GOTO=http://www.google.de/
'Find the search text box
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f ATTR=NAME:q
'Send a click to it
DS CMD=CLICK X={{!TAGX}} Y={{!TAGY}} CONTENT=iMacros
'Get its Y coordinate
SET !VAR1 {{!TAGY}}
'Increase it by 20 to match the coordinate of the first item in the list
ADD !VAR1 20
'And click the first item in the list
DS CMD=CLICK X={{!TAGX}} Y={{!VAR1}}
I am just guessing here as it could be something different in your case, hope its a good guess :)

Best regards,
Daniel, iOpus Support
cknorr
Posts: 4
Joined: Tue Jul 20, 2010 8:28 pm

Re: jQuery

Post by cknorr » Thu Jul 22, 2010 6:10 pm

Thanks Daniel -- I appreciate your support and completely understand the limitations with what you can provide.

Interestingly enough, I found a web site that shows the JQuery mcDropdown plug-in and iMacros works fine with it. (http://www.givainc.com/labs/mcdropdown_ ... plugin.htm). The main difference between what they are doing and what we are doing is that in the link that works they have hard-coded the values for the menu, where as in our case we are binding the available menu items from a data table, which is the results of a service call that is running an mdx query.

Perhaps this leads credence to your theory about ajax (or something similar?) being the root problem? Any possible solution you can think of so we can move forward with iMacros?

Thanks again!

Chris
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: jQuery

Post by Daniel, Tech Support » Thu Jul 22, 2010 9:15 pm

Hi Chris,

All McDropDown examples I could find worked well with iMacros, but may be because they indeed had hard-coded values. However, if the database values are loaded on page load an not dynamically on menu clicks, it shouldn't make any difference.
Assuming you have the values load dynamically per menu click, could you modify the following example for your menu and try running it in iMacros Browser:

Code: Select all

URL GOTO=http://www.givainc.com/labs/mcdropdown_jquery_plugin.htm     
TAG POS=1 TYPE=A ATTR=HREF:http://www.givainc.com/labs/mcdropdown_jquery_plugin.htm#   
TAG POS=1 TYPE=LI ATTR=TXT:Arts<SP>&<SP>Humanities<SP><BR><LF>Photography<SP><BR><LF>3D<SP>Digital<SP>History<SP>Literature<SP>
SET !VAR1 {{!TAGX}}
SET !VAR2 {{!TAGY}}
ADD !VAR1 5
ADD !VAR2 5
DS CMD=CLICK X={{!VAR1}} Y={{!VAR2}}
TAG POS=1 TYPE=LI ATTR=TXT:Photography<SP><BR><LF>3D<SP>Digital<SP>   
SET !VAR1 {{!TAGX}}
SET !VAR2 {{!TAGY}}
ADD !VAR1 5
ADD !VAR2 5
DS CMD=CLICK X={{!VAR1}} Y={{!VAR2}}
TAG POS=1 TYPE=LI ATTR=TXT:3D<SP>
?

Normally it would be just:

Code: Select all

URL GOTO=http://www.givainc.com/labs/mcdropdown_jquery_plugin.htm     
TAG POS=1 TYPE=A ATTR=HREF:http://www.givainc.com/labs/mcdropdown_jquery_plugin.htm#   
TAG POS=1 TYPE=LI ATTR=TXT:Arts<SP>&<SP>Humanities<SP><BR><LF>Photography<SP><BR><LF>3D<SP>Digital<SP>History<SP>Literature<SP>
TAG POS=1 TYPE=LI ATTR=TXT:Photography<SP><BR><LF>3D<SP>Digital<SP>   
TAG POS=1 TYPE=LI ATTR=TXT:3D<SP>
But for AJAX code that expects clicks, I added this after each menu item:

Code: Select all

SET !VAR1 {{!TAGX}}
SET !VAR2 {{!TAGY}}
ADD !VAR1 5
ADD !VAR2 5
DS CMD=CLICK X={{!VAR1}} Y={{!VAR2}}
These commands get the coordinates of the last menu item that was found with a TAG command, increase them by 5, not to click an edge and then click the coordinates.

Best regards,
Daniel, iOpus Support
ghule_mahesh
Posts: 1
Joined: Tue Jan 02, 2007 12:04 pm
Contact:

Re: jQuery

Post by ghule_mahesh » Mon Aug 30, 2010 1:51 pm

For the same problem, i am providing a URL for checking the jQuery dropdown. Please follow the steps to access a jquery dropdown:

1. GoTo https://www.dreamspark.com/default.aspx
2. Sign in with any Live ID account
3. After sign in, on the homepage you will see a "Get Started" section on the left column
4. Click on the "Get Verified" link from the "Get Started" section
5. On the /verify/default.aspx page you will see "What country do you live in?" dropdown built using jQuery.

It is giving problem in selecting a country from a dropdown.

Also, if you click "Verify as a student" and then "Get verified through my School", you will see a continue button. Click on the continue button will navigate to next page. On this page, if we select United States, then state and if we select state then cities are displayed.

I am facing problems for preparing a script for these controls. Hope this will help dignose the jquery problem.
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: jQuery

Post by Daniel, Tech Support » Tue Aug 31, 2010 10:32 am

Hi,

What is the problem you're having with the "Country" drop-down? I could select it with no problem using either of the lines:

Code: Select all

TAG POS=1 TYPE=A ATTR=TXT:Germany
TAG POS=1 TYPE=A ATTR=TXT:France
TAG POS=1 TYPE=A ATTR=TXT:Israel
Technically that control is not a drop-down, but a collection of links.

Let me know if you're still facing difficulties.

Best regards,
Daniel, iOpus Support
jason_marcus
Posts: 2
Joined: Sun Dec 23, 2012 3:54 am

Re: jQuery

Post by jason_marcus » Sun Dec 23, 2012 4:00 am

I have a Mac, so I couldn't use the iMacros Browser or IE. Unfortunately, the Chrome and Firefox version do not have the DS command, so I can't interact with jQuery/ AJAX elements. The majority of developers in California test on AJAX rich sites, with Macs. Can you please tell me how I can use DS or other commands to work with AJAX?

Thank you!
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: jQuery

Post by Daniel, Tech Support » Sun Dec 23, 2012 1:19 pm

Hi Jason,

This request comes just in time! :)

Please have a look at our experimental EVENT command and let us know what you think:
http://forum.imacros.net/viewtopic.php?f=20&t=19665

Best regards,
Daniel, iOpus Support
Post Reply