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.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

How to select checkbox in row based on cell txt ?

by badziu on Mon Feb 27, 2017 7:03 am

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 6:10 am, edited 1 time in total.
badziu
 
Posts: 4
Joined: Mon Feb 27, 2017 6:52 am

Re: Select checkbox in row based on cell txt

by chivracq on Mon Feb 27, 2017 11:29 am

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 5:56 am, edited 1 time in total.
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 5730
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Select checkbox in row based on cell txt

by badziu on Tue Feb 28, 2017 1: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 ? :?:
badziu
 
Posts: 4
Joined: Mon Feb 27, 2017 6:52 am

Re: Select checkbox in row based on cell txt

by chivracq on Tue Feb 28, 2017 5:54 am

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)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 5730
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

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

by badziu on Tue Feb 28, 2017 6:13 am

2: iMacros Browser (x86) Version 11.5.498.2403 on Windows
badziu
 
Posts: 4
Joined: Mon Feb 27, 2017 6:52 am

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

by chivracq on Tue Feb 28, 2017 9:20 am

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)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 5730
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

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

by badziu on Wed Mar 01, 2017 2:32 am

It works perfectly, big thanks !
badziu
 
Posts: 4
Joined: Mon Feb 27, 2017 6:52 am

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

by chivracq on Wed Mar 01, 2017 8:45 pm

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)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 5730
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to Data Extraction and Web Screen Scraping

Who is online

Users browsing this forum: No registered users and 2 guests

Website Monitoring