Something New: Defeating iMacros

Discussions and Tech Support specific to the iMacros Firefox add-on.
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
additional001
Posts: 175
Joined: Sun Jul 06, 2008 3:24 am

Something New: Defeating iMacros

Post by additional001 » Mon Oct 26, 2015 12:52 pm

So recently a web site that I have previously had problems writing scripts for did a redesign. Aesthetically it looked like a simple upgrade to HTML 5. So I thought I would give it a new shot and take a look at automating some things with iMacros again. I decided that this time I would start slow and work into more complex things. I did not think that I would have the door slammed in my face RIGHT OFF THE BAT. Now I'm not a professional web developer or a professional scripter so I'm bringing this here for verification that I'm actually seeing this...

When doing a conventional record ( iMacros 8.9.4 on FF DE 43.0a2 on Win 8.1) with whole tag and favored element ids on a target I get this ...

Code: Select all

TAG POS=1 TYPE=DIV ATTR=CLASS:sbTrayListItemHeaderImgContainer&&ID:sbTrayListItemHeaderImgContainer54559-563&&TXT:
Referencing the element in the DOM you see this.

Code: Select all

<div id="sbTrayListItemHeaderImgContainer54559-563" class="sbTrayListItemHeaderImgContainer" style="background-image: url("//www.sbx-media.com/img/frontends/icon/sponsor-26.jpg?v=402537"); outline: 1px solid blue;"></div>
When you play the script it won't follow the link. Now I think traditionally iMacros is used to dealing with anchors to follow links. But if I'm reading this correctly... somehow this site is embedding a url call in an embedded style tag!?!?!?!? If this is the case this is MIND BLOWING to me. I have NEVER seen anything like this in CSS and a casual search on w3schools I couldn't find anything. I'm going to keep searching but can anyone give any information on this.

Have any of you seen this? Were you able to circumvent it? Find any documentation on how they did this with CSS? Please comment!
chivracq
Posts: 9186
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Something New: Defeating iMacros

Post by chivracq » Mon Oct 26, 2015 1:50 pm

additional001 wrote:So recently a web site that I have previously had problems writing scripts for did a redesign. Aesthetically it looked like a simple upgrade to HTML 5. So I thought I would give it a new shot and take a look at automating some things with iMacros again. I decided that this time I would start slow and work into more complex things. I did not think that I would have the door slammed in my face RIGHT OFF THE BAT. Now I'm not a professional web developer or a professional scripter so I'm bringing this here for verification that I'm actually seeing this...

When doing a conventional record ( iMacros 8.9.4 on FF DE 43.0a2 on Win 8.1) with whole tag and favored element ids on a target I get this ...

Code: Select all

TAG POS=1 TYPE=DIV ATTR=CLASS:sbTrayListItemHeaderImgContainer&&ID:sbTrayListItemHeaderImgContainer54559-563&&TXT:
Referencing the element in the DOM you see this.

Code: Select all

<div id="sbTrayListItemHeaderImgContainer54559-563" class="sbTrayListItemHeaderImgContainer" style="background-image: url("//www.sbx-media.com/img/frontends/icon/sponsor-26.jpg?v=402537"); outline: 1px solid blue;"></div>
When you play the script it won't follow the link. Now I think traditionally iMacros is used to dealing with anchors to follow links. But if I'm reading this correctly... somehow this site is embedding a url call in an embedded style tag!?!?!?!? If this is the case this is MIND BLOWING to me. I have NEVER seen anything like this in CSS and a casual search on w3schools I couldn't find anything. I'm going to keep searching but can anyone give any information on this.

Have any of you seen this? Were you able to circumvent it? Find any documentation on how they did this with CSS? Please comment!
URL of the Page not posted so I can't have a look myself but it looks to me like the "54559-563" part in the DIV ID is maybe dynamic (which you'll be able to identify by recording several times the same Action and you could then use a Wildcard to replace the changing part or maybe even completely remove the ID Attribute and only use the Class Attribute (you may have to adjust POS with POS=2 / 3 / etc or use Relative Positioning... stg like this:

Code: Select all

TAG POS=1 TYPE=DIV ATTR=CLASS:sbTrayListItemHeaderImgContainer&&ID:sbTrayListItemHeaderImgContainer*-*&&TXT:
or

Code: Select all

TAG POS=1 TYPE=DIV ATTR=CLASS:sbTrayListItemHeaderImgContainer&&TXT:
But...!, you seem to use precise Language and you don't say that the Element is not found (any RuntimeError (with '!ERRORIGNORE' deactivated)?) but that "it won't follow the Link", and I don't see any Hyperlink in the Source Extract you provided, only the URL of the Image in the DIV:
Image
If you expect a Link on that Image to be followed, it will probably be declared somewhere in the Source with a Function (with onHover and onClick) and that's the Link that needs to be identified and used in your Script.
There are several Methods, either you manage to isolate it (you might even have to reconstruct it from several parts) from the Source or you follow it once (if it's always the same) and you use 'URL GOTO' in your Script to force following it.

You could try using the EVENT Mode for the Click on the DIV Element, it is better than the Standard TAG Mode for simulating a Click on an Element and will have more chance to trigger the ONCLICK Event on that Element.

Stg else you can try is adding manually an Event to the TAG Statement using the 'CONTENT' Parameter like in "CONTENT=EVENT:MOUSEOVER". There is no Event documented in the Wiki about a Mouse Click but you might get lucky and it might exist, stg like:

Code: Select all

TAG POS=1 TYPE=DIV ATTR=CLASS:sbTrayListItemHeaderImgContainer&&TXT: CONTENT=EVENT:MOUSECLICK
I dunno really, but try with "MOUSECLICK", "MOUSEONCLICK", "ONCLICK", "CLICK" etc...

Post the URL of your Page if you don't come out by yourself, or upload your Page (zipped) to your Thread and I can have a look at it... :idea:
Good luck and post your Results...
Last edited by chivracq on Mon Oct 26, 2015 5:37 pm, edited 1 time in total.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
additional001
Posts: 175
Joined: Sun Jul 06, 2008 3:24 am

Re: Something New: Defeating iMacros

Post by additional001 » Mon Oct 26, 2015 5:09 pm

I did a complete save of the site and uploaded it because it requires a login to get to the point that I'm trying to start at. If you remember in my OP the image that was shown should be on the page and you should be able to track it down in the DOM then.

As far as recording it goes I have exhausted all the default methods minus the X/Y coords (let's face it that thing has zero portability). I have not tried relative positioning as suggestion (I really hope it does not come to that!)

There are ON MOUSEOVER or ON HOVER events tied to the image... but they and the background image all seem to tie to the same page (which I can't find! in the DOM!) I don't know if it's static or dynamic... I can say that it does look the same each time... but that is NO guarantee of static content.

Well.... I was going to upload the zip... but its like 500K and the limit is 256K... SO I don't know what to do lol
chivracq
Posts: 9186
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Something New: Defeating iMacros

Post by chivracq » Mon Oct 26, 2015 5:54 pm

additional001 wrote:I did a complete save of the site and uploaded it because it requires a login to get to the point that I'm trying to start at. If you remember in my OP the image that was shown should be on the page and you should be able to track it down in the DOM then.

As far as recording it goes I have exhausted all the default methods minus the X/Y coords (let's face it that thing has zero portability). I have not tried relative positioning as suggestion (I really hope it does not come to that!)

There are ON MOUSEOVER or ON HOVER events tied to the image... but they and the background image all seem to tie to the same page (which I can't find! in the DOM!) I don't know if it's static or dynamic... I can say that it does look the same each time... but that is NO guarantee of static content.

Well.... I was going to upload the zip... but its like 500K and the limit is 256K... SO I don't know what to do lol
Yep, I agree with you about the X/Y Mode, I always try to avoid it as I consider it as not very reliable, but there is nothing wrong with using Relative Positioning, it is very reliable and often much more reliable than having to use a "POS=37" for example... (and it could be used only if I'm correct about my assumption about a Dynamic ID, you didn't really answer about that if several Recordings give the same ID in the Macro..., and I won't be able to check that myself as your HTML Saveas will just be one Saveas, I won't be able to refresh the Page...)

Yep, the 256Kb Limit is a pain in the ass regularly, I've already fought against TechSupport to try to increase it, but to no avail... You can upload it to your GoogleDrive and share the Link or to some Upload Site like WeTransfer, ... or you can send it to me per E-mail at [My_Pseudo_on_the_Forum]@gmail.com...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply