How to select checkbox in row based on cell txt ?

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
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
badziu
Posts: 4
Joined: Mon Feb 27, 2017 1:52 pm

How to select checkbox in row based on cell txt ?

Post by badziu » Mon Feb 27, 2017 2:03 pm

Hello, how can I select checkbox in row selected by data inside cell.
Example:

<form>
<table>
<tr><td><input name"CheckBoxName" type="checkbox"/></td><td><span>Description 1</span></td><td><span>1,00</span></td></tr>
<tr><td><input name"CheckBoxName" type="checkbox"/></td><td><span>Description 2</span></td><td><span>2,00</span></td></tr>
<tr><td><input name"CheckBoxName" type="checkbox"/></td><td><span>Description 1</span></td><td><span>1,00</span></td></tr>
</table>
</form>

In this example I want to select checkboxes only when data in second cell = "Description*" and data in third cell = "1,00".
How can I do this ?
Last edited by badziu on Tue Feb 28, 2017 1:10 pm, edited 1 time in total.
chivracq
Posts: 9374
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Select checkbox in row based on cell txt

Post by chivracq » Mon Feb 27, 2017 6:29 pm

badziu wrote:Hello, how can I select checkbox in row selected by data inside cell.
Example:

Code: Select all

<form>
<table>
<tr><td><input name"CheckBoxName" type="checkbox"/></td><td><span>Description 1</span></td><td><span>1,00</span></td></tr>
<tr><td><input name"CheckBoxName" type="checkbox"/></td><td><span>Description 2</span></td><td><span>2,00</span></td></tr>
<tr><td><input name"CheckBoxName" type="checkbox"/></td><td><span>Description 1</span></td><td><span>1,00</span></td></tr>
</table>
</form>
In this example I want to select checkboxes only when data in second cell = "Description*" and data in third cell = "1,00".
1- Several Question Marks missing in your Thread Title and Post-Content, you are asking a Qt and not sharing a HowTo...! :roll:

2- CIM...! :mrgreen:

3- Classical Case for Relative Positioning I would think... :idea:

EDIT: Numbers 1-2-3 added for systematic Answering... :roll:
Last edited by chivracq on Tue Feb 28, 2017 12:56 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...
badziu
Posts: 4
Joined: Mon Feb 27, 2017 1:52 pm

Re: Select checkbox in row based on cell txt

Post by badziu » Tue Feb 28, 2017 8:29 am

chivracq wrote: Several Question Marks missing in your Thread Title and Post-Content, you are asking a Qt and not sharing a HowTo...! :roll:

CIM...! :mrgreen:

Classical Case for Relative Positioning I would think... :idea:
Actually, I'm sorry.

I tried relative positioning, but I can't choose TR based on two condition:

Code: Select all

TAG POS=1 TYPE=TR ATTR=TXT:Description*&&TXT:1,00
chivracq can you help me ? :?:
chivracq
Posts: 9374
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Select checkbox in row based on cell txt

Post by chivracq » Tue Feb 28, 2017 12:54 pm

badziu wrote:Actually, I'm sorry.

I tried relative positioning, but I can't choose TR based on two condition:

Code: Select all

TAG POS=1 TYPE=TR ATTR=TXT:Description*&&TXT:1,00
chivracq can you help me ? :?:
Maybe..., if you don't "ignore" Part_1 and Part_2 of my previous Reply... :roll:
(I've added Numbers to my previous Reply for systematic Answering...)
- (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...
badziu
Posts: 4
Joined: Mon Feb 27, 2017 1:52 pm

Re: How to select checkbox in row based on cell txt ?

Post by badziu » Tue Feb 28, 2017 1:13 pm

2: iMacros Browser (x86) Version 11.5.498.2403 on Windows
chivracq
Posts: 9374
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to select checkbox in row based on cell txt ?

Post by chivracq » Tue Feb 28, 2017 4:20 pm

badziu wrote:2: iMacros Browser (x86) Version 11.5.498.2403 on Windows
1- You missed 1 Qt Mark, but OK, never mind...

2- FCI, hum, "Windows" is still pretty vague, ah-ah...!, the "F" in "FCI" stands for "Full" (= with all exact Versions), won't play a role in this Case, but remember to mention your FCI next time you open a Thread, I don't even read the Qt normally if FCI is not mentioned, and I don't ask 20 times...

3- Relative Positioning... Well your "I tried relative positioning, but I can't choose TR based on two condition:"

Code: Select all

TAG POS=1 TYPE=TR ATTR=TXT:Description*&&TXT:1,00
... is indeed not correct, but you should be able to select the Row/'TR' with:

Code: Select all

TAG POS=1 TYPE=TR ATTR=TXT:*Description*1,00*
Well..., you might have to play with "POS=n" if several Rows match the "ATTR=TXT:*Description*1,00*" Condition...
I am not sure though if tagging the whole Row will select your CheckBox, it might work directly indeed, but if it doesn't, then you can use R-Positioning, BUT...!, because your CB is located in a Cell/'TD' within the same 'TR', you will probably have to use "Double Relative Positioning" to get outside of the 'TR' for iMacros to be able to "see" inside it again with for example stg like:

Code: Select all

TAG POS=1 TYPE=TR ATTR=TXT:*Description*1,00*
TAG POS=R-1 TYPE=TR ATTR=*
TAG POS=R1 TYPE=INPUT:CHECKBOX ATTR=* CONTENT=YES
Well, I supposed that your 'TABLE' has a Header for the 'R-1', not present in your truncated/edited Source, so I don't know how the original/complete Source looks like..., if the Table has not Header, then you can try with 'TYPE=*' or 'TYPE=DIV' or 'TYPE=SPAN', there is always a 'DIV' or a 'SPAN' present...

Other Method if tagging the whole Row/TR as the Anchor doesn't work straight away, is then to use twice Relative Positioning, with stg like:

Code: Select all

TAG POS=1 TYPE=TD ATTR=TXT:Description*
TAG POS=R1 TYPE=TD ATTR=TXT=1,00
TAG POS=R-1 TYPE=INPUT:CHECKBOX ATTR=* CONTENT=YES
But this Method might be "dangerous" as the 'R1' might "catch" the "1,00" Cell from the next Row, depending on what Content your Cells/Rows can have and especially what remains constant and what Values can change... The "'Technique" is then to first extract the "x,00" Content for then using 'EVAL()' to spit out a "-1" if x=1 or a "0" is x<>1 to reuse for 'POS={{VAR1}}' on the CB. It's a bit more complicated but I guess you get the Principle... :wink:
- (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...
badziu
Posts: 4
Joined: Mon Feb 27, 2017 1:52 pm

Re: How to select checkbox in row based on cell txt ?

Post by badziu » Wed Mar 01, 2017 9:32 am

It works perfectly, big thanks !
chivracq
Posts: 9374
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to select checkbox in row based on cell txt ?

Post by chivracq » Thu Mar 02, 2017 3:45 am

badziu wrote:It works perfectly, big thanks !
Yeah, but but which one...? I gave you 3 Methods/Scripts, which one is working...!?

But, OK, never mind, glad it works but I will think twice next time before trying to help you... Getting you FCI was a bit of a hassle, "Relative Positioning...", "I tried, it doesn't work...", I explain in Depth how I think it will work, it works indeed and all you can say is "Oh..., it works...!" (with Feedback and a Thanks, luckily...), but the Feedback could have been a bit more "precise"... :roll:
- (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