ibotubot 3 Posted January 30, 2017 Report Share Posted January 30, 2017 Hi all, Question , I am trying to click a button using offsets. So lets say there is a delete button and they are all 100% the same so I am using element offset. - I have scraped how many buttons are on the page- I have a list of ids that are not allowed to match the offset -->Example--> Let's say there are 20 buttons (this always varies)--> My List with ID contains 0,5,8,12,18 (this also varies so a hardcoded else if will be getting quite long) How do I click on all DELETE buttons except (0,5,8,12,18) ? I know I could do as many else if as i have IDs in my list , but that list could literally be one item or all 20... SO as you see working with hard coded else if is not really that great of a solution here Thanks, Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted January 30, 2017 Report Share Posted January 30, 2017 Hi, Try something like this... set(#offset index,0,"Global") loop(20) { if($comparison(#offset index,"!= Does not equal",$find regular expression(#offset index,"0|5|8|12|18"))) { then { alert("{#offset index} I can click it!") comment("click here and put #var in offset") } } increment(#offset index) } count the elements to put in the loop cycles Regards,Nick Quote Link to post Share on other sites
ibotubot 3 Posted January 30, 2017 Author Report Share Posted January 30, 2017 Thanks Nick, will give it a try later. Did not think of using regex properly, so thanks for the reminder here. Quote Link to post Share on other sites
ibotubot 3 Posted January 31, 2017 Author Report Share Posted January 31, 2017 Ok just needed that input. Solved Given the regex all I needed to do is loop through by list total (my ids), then just add each id to the variable with "|" and thats all : Thanks ! Quote Link to post Share on other sites
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.