SEARCH command on page in a frame

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
ABooth
Posts: 223
Joined: Mon Aug 10, 2009 4:25 pm

SEARCH command on page in a frame

Post by ABooth » Tue Oct 19, 2010 7:58 pm

If I try to run the SEARCH command on a sub page using the FRAME F=n or FRAME Name=name
The expression is only ever run on the top page that contains the Frameset.

How do I get it to act on the frame contents instead?

Example: -
Frameset

Code: Select all

<html>
	<head></head>
	<FRAMESET framespacing="0" rows="90,*,55" frameborder="yes">
		<FRAME name="mainmenu" scrolling="auto" target="main" src="MainMenuBar.asp"/>
		<FRAME name="main" src="MessageScreen.htm"/>
		<FRAME name="bottom" src="BottomBar.asp"/>
		<noframes>
			<body>
				<p>This page uses frames, but your browser doesn't support them.</p>
			</body>
		</noframes>
	</FRAMESET>
</html>
MessageScreen.htm

Code: Select all

<html>
	<head></head>
	<body>
		Hello World
  </body>
</html>
and run the expression

SEARCH Example

Code: Select all

FRAME NAME=main
SEARCH SOURCE=REGEXP:"(rows)(=)(\")(\\d+)(,)(\\*)(,)(\\d+)" EXTRACT="$8"
PROMPT {{!EXTRACT}}
The prompt returns 55.

If I run this, I get an error instead of "Hello"

Code: Select all

FRAME NAME=main
SEARCH SOURCE=REGEXP:"(Hello)( )(World)" EXTRACT="$1"
PROMPT {{!EXTRACT}}
Error
Error -1320: Source does not match REGEXP=(Hello)( )(World). Line 2: SEARCH SOURCE=REGEXP:"(Hello)( )(World)" EXTRACT="$1"
Thanks.
iMacros for Firefox supports JavaScript Macros (Scripting)
JavaScript supports Java via LiveConnect

Therefore: You can write powerful macros with iMacros for Firefox. Have a look at this one

Post feature requests here. Maybe one day, they'll pin it?
Tom, Tech Support
Posts: 3601
Joined: Mon May 31, 2010 4:59 pm

Re: SEARCH command on page in a frame

Post by Tom, Tech Support » Wed Oct 20, 2010 11:09 am

Hello ABooth,

The SEARCH command is designed to only work with the current HTML page source. As a workaround, if you know the address of the frame page, you could try loading it into a new tab with URL GOTO and then doing the SEARCH on that tab.
Regards,

Tom, iMacros Support
ABooth
Posts: 223
Joined: Mon Aug 10, 2009 4:25 pm

Re: SEARCH command on page in a frame

Post by ABooth » Wed Oct 20, 2010 12:52 pm

Tom, iOpus wrote:Hello ABooth,

The SEARCH command is designed to only work with the current HTML page source. As a workaround, if you know the address of the frame page, you could try loading it into a new tab with URL GOTO and then doing the SEARCH on that tab.
Thanks, but the page I want to scrape, is actually an asp page that is generated from an http post from another page. I can not call it with an HTTP GET

It's pretty much useless if it only acts on the parent page, as a large number of sites on the internet use framesets.
iMacros for Firefox supports JavaScript Macros (Scripting)
JavaScript supports Java via LiveConnect

Therefore: You can write powerful macros with iMacros for Firefox. Have a look at this one

Post feature requests here. Maybe one day, they'll pin it?
Tom, Tech Support
Posts: 3601
Joined: Mon May 31, 2010 4:59 pm

Re: SEARCH command on page in a frame

Post by Tom, Tech Support » Wed Oct 20, 2010 5:50 pm

I have put this on our feature request list. As a workaround, you could extract the bulk text with a TAG command, and then use a regex in script code to parse exactly what you need.
Regards,

Tom, iMacros Support
Tom, Tech Support
Posts: 3601
Joined: Mon May 31, 2010 4:59 pm

Re: SEARCH command on page in a frame

Post by Tom, Tech Support » Fri Nov 05, 2010 11:21 am

Hi ABooth,

I misspoke previously. I now realize that the following usage of the SEARCH command works in iMacros for Firefox, but not in the iMacros Browser:

Code: Select all

TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://www.iopus.com/imacros/demo/v5/frames/index.htm
FRAME F=3
SEARCH SOURCE=TXT:"Frame3"
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f3 ATTR=NAME:T1 CONTENT=Frame3
I have logged this issue for further investigation by the development team.
Regards,

Tom, iMacros Support
Post Reply