Relative to text

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
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

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
yoav
Posts: 14
Joined: Mon Oct 20, 2008 11:16 am

Relative to text

Post by yoav » Mon Oct 20, 2008 2:17 pm

Hi,

I'm trying to check a checkbox in a page that looks like this:

<div>
<input class='site_list' type='checkbox' name='sitebox[]' value='436947' >test11.site1<br>
<input class='site_list' type='checkbox' name='sitebox[]' value='436950' checked='true'>test111.site1 (test2.test)<br>
<input class='site_list' type='checkbox' name='sitebox[]' value='437690' >test111111.site1<br>
</div>

I have no inforamtion about the id (placed in the value attribute) and I need to find it by the name, which is just text in the div
i.e, I need to check the box with value 436947 by using "test11.site1"

Is there any way to accomplish this ?

Thanks

Yoav.
User avatar
Tech Support
Posts: 4948
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Re: Relative to text

Post by Tech Support » Mon Oct 20, 2008 6:36 pm

Hello, you have the same setup as shown in this screenshot.
=> Please see the paragraph about Backwards relative positions, this will solve this task!

Based on the HTML snippet above, I assume these two lines are correct:
TAG POS=1 TYPE=TD ATTR=TXT:test11.site1
TAG POS=R-1 TYPE=INPUT:CHECKBOX FORM=NAME:* ATTR=NAME:* CONTENT=YES
yoav
Posts: 14
Joined: Mon Oct 20, 2008 11:16 am

Re: Relative to text

Post by yoav » Mon Oct 20, 2008 9:32 pm

Hi,

Thanks for your reply.

the code you posted would work if the text was indeed within a <td> tag, however if you look again at the html sniplet, you'll see it's just free text within a div so that code doesn't work.

any other ideas ?
User avatar
Tech Support
Posts: 4948
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Re: Relative to text

Post by Tech Support » Tue Oct 21, 2008 3:41 pm

Ah, I see the problem now, too: For iMacros all three texts are part of ONE div element, so you can not select them individually ( = you can not get a blue frame around the text only).
checkbox div.png
checkbox div.png (17.69 KiB) Viewed 13252 times
Solutions:
1. Do you know the order of the texts? Then you can select the boxes by their position (POS=1,2 etc)
URL GOTO=file:///D:/1tmp/a.htm
TAG POS=2 TYPE=INPUT:CHECKBOX FORM=NAME:NoFormName ATTR=NAME:sitebox[]&&VALUE:* CONTENT=YES

2. If you do not know the order, you need to add steps to find out the order:

a. Extract the complete text with TAG POS=1 TYPE=DIV ATTR=TXT:* EXTRACT=HTM

b. Parse this text to get the order that corresponds to a certain text. This can be done easily with VBS or any other scripting language. In VBS you can use for example the instr command, in VB.NET/C#/Perl you can also use Regex. If you are a Gold Support customer, our customer support can write this script for you, too.
(b1. Alternatively you can get the value that corresponds to a text with this method, too.)

c. Now you can use Solution #1
Post Reply