Jump to content

finding a location within a web page, and clicking on it


setirich
 Share

Recommended Posts

Hi All!

Having a problem with clicking on a specific web page location. Of course, it's Javascript, and that just make it 10x harder.

I'm doing all the searching within this construct

$Htmcpy = _IDBodyReadHTML($oIE)

I then write out the page to a file, and then attempt to find and click on the next page indicator.

I can locate the  proper spot within the string easy enough, but having trouble with what I do to click on the page marker.

Here is the HTML string that contains the item to click on:

<td><span>1</span></td><td><a style="color: white;" href="javascript:__doPostBack('gvResults','Page$2')">2</a></td><td><a style="color: white;" href="javascript:__doPostBack('gvResults','Page$3')">3</a></td><td><a style="color: white;" href="javascript:__doPostBack('gvResults','Page$4')">4</a></td><td><a style="color: white;" href="javascript:__doPostBack('gvResults','Page$5')">5</a></td><td><a style="color: white;" href="javascript:__doPostBack('gvResults','Page$6')">6</a></td><td><a style="color: white;" href="javascript:__doPostBack('gvResults','Page$7')">7</a></td><td><a style="color: white;" href="javascript:__doPostBack('gvResults','Page$8')">8</a></td><td><a style="color: white;" href="javascript:__doPostBack('gvResults','Page$9')">9</a></td><td><a style="color: white;" href="javascript:__doPostBack('gvResults','Page$10')">10</a></td><td><a style="color: white;" href="javascript:__doPostBack('gvResults','Page$11')">...</a></td>

The actual text on the page looks like this:        12345678910...      and the total number of pages may be into the thousands. Yes, there are only 10 records per page & to get beyond 10 I actually have to click on the  ...  to get the next group of numbers up.       

So I can end up with a text string that looks something like this        1234123512361237123812391240...

A simple regex finds and extracts the page number I want

Local $xp = $X + 1                   ; I want the next page which is current page plus 1
Local $rexp = ">(" & $xp & ")</a>"     ; this locates the page # and extracts is to
Local $page = $ox[0]     ; the actual page as displayed

I've tried a lot of things like trying to focus on that spot ID'd. within that text string OR the html string, and then click on it.

Any ideas on where to start?

Thanks, Rich

Edited by setirich
spelled my name wrong!!!

Good intentions will always be pleaded for every assumption of authority. It is hardly too strong to say that the Constitution was made to guard the people against the dangers of good intentions. There are men in all ages who mean to govern well, but they mean to govern. They promise to be good masters, but they mean to be masters.-Daniel Webster

Link to comment
Share on other sites

Thanks for your replies. I'm using the latest (?) AU3 version 3.3.14.2, and I've used the built in IE.au3 since it was first released as part of the general release. I think I used Dales original UDF since he first posted it years ago.

There is not a simple URL change on page change. That's always the first choice for simple scraping. Here is the URL for the search page:

http://www.occeweb.com/MOEAsearch/index.aspx

For example, put in just the letter p in the last name box, and select the Begins with option button. you'll get 2793 records, and that will be 280 pages.

My experimentation so far actually gets the data on the page, but will not advance to page 2, 3, etc. Therefore, I get many copies of the first page, which is not what I want.

 

Good intentions will always be pleaded for every assumption of authority. It is hardly too strong to say that the Constitution was made to guard the people against the dangers of good intentions. There are men in all ages who mean to govern well, but they mean to govern. They promise to be good masters, but they mean to be masters.-Daniel Webster

Link to comment
Share on other sites

I'm not sure why eval would help me. I already know the specifics of the java as it's like this (for page 2):

<a style="color: white;" href="javascript:__doPostBack('gvResults','Page$2')">2</a>

Each page will be similar with a change toe the ~Page$2">2</a>   to   Page$3">3</a>

I think this is one of those things that requires a 'real' click on the >2<  and it's just a question of how to actually do that.

But then, I'm probably totally wrong....8-\

Good intentions will always be pleaded for every assumption of authority. It is hardly too strong to say that the Constitution was made to guard the people against the dangers of good intentions. There are men in all ages who mean to govern well, but they mean to govern. They promise to be good masters, but they mean to be masters.-Daniel Webster

Link to comment
Share on other sites

56 minutes ago, setirich said:

I'm not sure why eval would help me. I already know the specifics of the java as it's like this (for page 2):

<a style="color: white;" href="javascript:__doPostBack('gvResults','Page$2')">2</a>

Each page will be similar with a change toe the ~Page$2">2</a>   to   Page$3">3</a>

Exactly... so instead of trying to locate the appropriate element and then click on it, I was suggesting that you use Eval() to execute the Javascipt command to take you to the desired page.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...