iimSet() iimPlay and Javascript / jQuery issues

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
flish
Posts: 1
Joined: Wed Mar 13, 2013 1:17 pm

iimSet() iimPlay and Javascript / jQuery issues

Post by flish » Wed Mar 13, 2013 6:50 pm

I need to check an online account, review what is published and, if necessary, delete some items
Because the html markup is really sloppy and elements lack ids or classes, I need to use some javascript/jquery.

This is what I have done so far:

Code: Select all

var count=$('ul[id="paging"]').children('li').children('a').length;
var pg1=count-1;
var pag="https://test-site.com/?";
pag1=pag+pg1;

var pg2=count-2;
var pag="https://test-site.com/?";
pag2=pag+pg2;

function foo(){
$('td[class="pa_center"]').each(function () {
	var sirtd = $(this).text();
	sir = $.trim(sirtd);
	if (sir=="57"){
		$(this).siblings('td[nowrap="nowrap"]').children('input[type="checkbox"]').prop('checked', true);
	}
});
}


miscapagina1 =  "CODE:";
miscapagina1 +=  "URL GOTO={{pag1}}" + "\n";
	
miscapagina2 =  "CODE:";
miscapagina2 +=  "URL GOTO={{pag2}}" + "\n";

iimSet("pag1",pag1);
iimPlay(miscapagina1);
foo();

iimSet("pag2",pag2);
iimPlay(miscapagina2);
foo();
So far, so good, the first part works as expected, I can navigate through all the pages.

Now my problem is I need to check if there are items to delete on each of these pages and, of course, proceed with delete.
Which amounts to:
call foo()
click on submit
click on OK

When it gets to executing foo() it throws a -991 error: TypeError: can't access dead object (Error code: 991)
This only happens if I use jquery.
If I would be able to check that check box using only vanilla javascript, it would not break the code. Unfortunately I could not do it by simple javascript - what works beautifully with a few lines of jquery looks quite ugly in plain javascript and I could not, for the life of me, get to check the checkbox.
So, what is the problem with using jquery?
And, is there a workaround?
----------
Edit: forgot to mention: FF 19 on linux Mint (flavor of Debian - Ubuntu)
----------
Edit 2: managed to do it all with plain javascript. My question still stands - why is using jquery an issue?
Post Reply