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.

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.

Relative to text

by yoav on Mon Oct 20, 2008 7:17 am

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

Re: Relative to text

by Tech Support on Mon Oct 20, 2008 11:36 am

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
User avatar
Tech Support
 
Posts: 5003
Joined: Tue Sep 20, 2005 12:25 pm

Re: Relative to text

by yoav on Mon Oct 20, 2008 2: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 ?
yoav
 
Posts: 14
Joined: Mon Oct 20, 2008 4:16 am

Re: Relative to text

by Tech Support on Tue Oct 21, 2008 8:41 am

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 9549 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
User avatar
Tech Support
 
Posts: 5003
Joined: Tue Sep 20, 2005 12:25 pm


Return to General Support & Discussions

Who is online

Users browsing this forum: No registered users and 7 guests

-->