Negative Relative Extraction Problem

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.

Negative Relative Extraction Problem

by sventhebrit on Mon Jul 28, 2008 2:13 pm

Hi All,
A total Newbie to iMacros and looking for some help from a more experienced user.

I have a problem with the negative relative extraction on eBay.com

Windows XP SP2
iMacros v6.2
Office 2003 - Using Excel VBA to control the iMacros Browser

I was trying to extract data from the ebay.com website. The listings are in batches of 50. I can extract the first 49 items and then it fails on the 50th. I have tried displaying 100 auctions to a page and it extracts the first 99 items and fails on the 100th - - the 50th items extracts OK in this instance. I have looked at the source of the eBay page and can see no difference in the formatting of the last item on each page.

To replicate, goto http://www.ebay.com and search for 'toner' (for example) -- at the time of writing there are 24,000+ items for 'toner' split over multiple pages. I have created a sample macro which demonstrates the problem. It extracts items 1, 2, 49, and 50 (note: In my VBA code, I use a loop and pass a variable called Pos to iMacro, change the page and then repeat the process). The logic I use is to find the time left on the page and then using negative relative positioning to extract the link which conforms to the following syntax - http://cgi.ebay.com/*.

Once you have navigated to the search results, run the simple macro below from within the browser.

Code: Select all
TAG POS=1 TYPE=SPAN ATTR=CLASS:time*
TAG POS=R-1 TYPE=A ATTR=TXT:*&&HREF:http://cgi.ebay.com/* EXTRACT=HREF
TAG POS=2 TYPE=SPAN ATTR=CLASS:time*
TAG POS=R-1 TYPE=A ATTR=TXT:*&&HREF:http://cgi.ebay.com/* EXTRACT=HREF
TAG POS=49 TYPE=SPAN ATTR=CLASS:time*
TAG POS=R-1 TYPE=A ATTR=TXT:*&&HREF:http://cgi.ebay.com/* EXTRACT=HREF
TAG POS=50 TYPE=SPAN ATTR=CLASS:time*
TAG POS=R-1 TYPE=A ATTR=TXT:*&&HREF:http://cgi.ebay.com/* EXTRACT=HREF


The first 3 items - 1,2 and 49 extract correctly. The last item - 50th - fails with #EANF#.

Any suggestions. I doubt it is a bug with iMacros, but any pointers on my code to do the extract would be appreciated.

Cheers
Steve :mrgreen:
sventhebrit
 
Posts: 3
Joined: Tue May 13, 2008 10:42 am

Re: Negative Relative Extraction Problem

by Renius on Mon Jul 28, 2008 8:47 pm

RuntimeError: element SPAN specified by CLASS:time* was not found, macro line 4
this is the first line of your code
Renius
 
Posts: 5
Joined: Mon Jul 28, 2008 8:34 pm

Re: Negative Relative Extraction Problem

by sventhebrit on Tue Jul 29, 2008 1:53 am

Hi there,

Not sure why you get the error when running the Macro.
I have added an extra line to the Macro which opens up a sample eBay webpage. If you cut and paste the code below into a new iMacro (iim File), open up the IMacros broswer and run the new macro.

It will extract items 1,2 and 49 OK and then fail on the 50th.

Thanks for your interest in my problem.
Steve

Code: Select all
URL GOTO=http://shop.ebay.com/?_from=R40&_trksid=m38&_nkw=toner&_sacat=See-All-Categories
TAG POS=1 TYPE=SPAN ATTR=CLASS:time*
TAG POS=R-1 TYPE=A ATTR=TXT:*&&HREF:http://cgi.ebay.com/* EXTRACT=HREF
TAG POS=2 TYPE=SPAN ATTR=CLASS:time*
TAG POS=R-1 TYPE=A ATTR=TXT:*&&HREF:http://cgi.ebay.com/* EXTRACT=HREF
TAG POS=49 TYPE=SPAN ATTR=CLASS:time*
TAG POS=R-1 TYPE=A ATTR=TXT:*&&HREF:http://cgi.ebay.com/* EXTRACT=HREF
TAG POS=50 TYPE=SPAN ATTR=CLASS:time*
TAG POS=R-1 TYPE=A ATTR=TXT:*&&HREF:http://cgi.ebay.com/* EXTRACT=HREF
sventhebrit
 
Posts: 3
Joined: Tue May 13, 2008 10:42 am

Re: Negative Relative Extraction Problem

by UKiMacrosUser on Mon Sep 08, 2008 2:11 am

Hi,

I am having exactly the same problem, though I only have 11 checkboxes to select.

Negative relative positioning works for the first 10 boxes but cannot find the 11th and last box... iMacro code below:

SET !TIMEOUT 300
TAB T=1
TAB CLOSEALLOTHERS
TAG POS=1 TYPE=HR
TAG POS=1 TYPE=TD ATTR=TXT:request<SP>returned<SP>no<SP>data*
TAG POS=R-1 TYPE=INPUT:CHECKBOX FORM=NAME:* ATTR=NAME:* CONTENT=YES
TAG POS=2 TYPE=TD ATTR=TXT:request<SP>returned<SP>no<SP>data*
TAG POS=R-1 TYPE=INPUT:CHECKBOX FORM=NAME:* ATTR=NAME:* CONTENT=YES
TAG POS=1 TYPE=TD ATTR=TXT:58558G20080822*
TAG POS=R-1 TYPE=INPUT:CHECKBOX FORM=NAME:* ATTR=NAME:* CONTENT=YES
TAG POS=1 TYPE=TD ATTR=TXT:58558D20080822*
TAG POS=R-1 TYPE=INPUT:CHECKBOX FORM=NAME:* ATTR=NAME:* CONTENT=YES
TAG POS=3 TYPE=TD ATTR=TXT:request<SP>returned<SP>no<SP>data*
TAG POS=R-1 TYPE=INPUT:CHECKBOX FORM=NAME:* ATTR=NAME:* CONTENT=YES
TAG POS=4 TYPE=TD ATTR=TXT:request<SP>returned<SP>no<SP>data*
TAG POS=R-1 TYPE=INPUT:CHECKBOX FORM=NAME:* ATTR=NAME:* CONTENT=YES
TAG POS=1 TYPE=TD ATTR=TXT:54294G20080822*
TAG POS=R-1 TYPE=INPUT:CHECKBOX FORM=NAME:* ATTR=NAME:* CONTENT=YES
TAG POS=1 TYPE=TD ATTR=TXT:54294D20080822*
TAG POS=R-1 TYPE=INPUT:CHECKBOX FORM=NAME:* ATTR=NAME:* CONTENT=YES
TAG POS=1 TYPE=TD ATTR=TXT:31023K20080822*
TAG POS=R-1 TYPE=INPUT:CHECKBOX FORM=NAME:* ATTR=NAME:* CONTENT=YES
TAG POS=1 TYPE=TD ATTR=TXT:31023H20080822*
TAG POS=R-1 TYPE=INPUT:CHECKBOX FORM=NAME:* ATTR=NAME:* CONTENT=YES
TAG POS=1 TYPE=TD ATTR=TXT:31023G20080822*
TAG POS=R-1 TYPE=INPUT:CHECKBOX FORM=NAME:* ATTR=NAME:* CONTENT=YES

The last line fails. The TD with text attribute 31023G20080822 is definitely found because it is highlighted in blue, and if I change the last line to find the TABLE CELL (TD) at position R-1 this is also found as it is highlighted in blue - however, even though the web page html is exactly the same for all rows of this table, iMacros cannot locate the last checkbox.

Please help!
UKiMacrosUser
 
Posts: 6
Joined: Wed Feb 20, 2008 10:06 am

Re: Negative Relative Extraction Problem

by Fidibus on Thu Mar 12, 2009 6:39 am

Hi,
I just wanted to check whether there is some thread that answers the problem with negative relative positioning at the end of pages.
I also extract data from a table and relative negative positioning works perfectly well until the last element (i.e., 50++ times) where suddenly an error "-317" occurs (which I couldn't see in your error code description) that tells me "Element empty" and then the simulation stops.
It is exactly the same problem as my pre-posters had. Any idea of how to resolve this?

Cheers, Konrad
Fidibus
 
Posts: 6
Joined: Thu Mar 12, 2009 6:30 am

Re: Negative Relative Extraction Problem

by BrianR on Thu Mar 12, 2009 9:23 am

I have placed this in some of my Macros to ignore an error.

Code: Select all
SET !LOADCHECK NO

' ==============================================================
' Loadcheck is turned off so an error would not occur if
' an input tag is not found.   ( May only have 3 rows not 10 )
' ==============================================================
BrianR
 
Posts: 126
Joined: Wed Jun 11, 2008 9:13 am

Re: Negative Relative Extraction Problem

by Hijotech on Mon Oct 09, 2017 6:59 pm

BrianR wrote:I have placed this in some of my Macros to ignore an error.

Code: Select all
SET !LOADCHECK NO

' ==============================================================
' Loadcheck is turned off so an error would not occur if
' an input tag is not found.   ( May only have 3 rows not 10 )
' ==============================================================


Google Chrome:61.0.3163.100
Os: Windows 7 x64
iMacros: 8.4.4



Hi,

I will like iMacros to bid a price of product online automatically by quary data from excel base on the shoe size such as the following: For Example

I have created list of shoes product and their cost base on sizes excel:

Dorothy's Ruby Red Shoes size
1. 206 --------- $35
2. 207 --------- $40
3. 507 --------- $48
4. 701 -------- $56
5. 800 -------- $80
6. 805 --------- $95

Now if iMacros click on the Shoe size, I want iMacros to automatically quary the excel data to locate the exact bid price of the shoe i specified in the excel file and input it into the price box on the web.

TAG POS=1 TYPE=INPUT:NUMBER ATTR=ID:inputPrice CONTENT="*"


If the iMacros select the Dorothy's Ruby Red Shoes size that are not on the excel file iMacros should skip to the next line of code which is:

Wait Seconds:840


Please Help
Hijotech
 
Posts: 14
Joined: Tue Sep 26, 2017 10:54 am


Return to Data Extraction and Web Screen Scraping

Who is online

Users browsing this forum: No registered users and 2 guests

-->