Sign in to follow this  
Followers 0
Gonnosuke

FF.au3 Help w/ a Tricky Xpath

3 posts in this topic

#1 ·  Posted (edited)

Hi,

Long time lurker, first time poster. I'm having trouble figuring out a way to extract info from a dynamic page that lists order information. The source for the page is making it difficult for me to find the correct Xpath. Here's a condensed snippet of the source to help illustrate:

<tr class="cart_item odd cancelled_line_item">
<td class="status_col">
<div class="first_row status">
Processing
</div>
<div class="second_row isbn">
9780133050691                                  <---- This is what I'm after
<br>
5606637
</div>
</td>
....
<tr class="cart_item even cancelled_line_item">
<td class="status_col">
<div class="first_row status">
Cancelled
</div>
<div class="second_row isbn">
9780133050691                                        <---- This is what I'm after
<br>
5606638
</div>
</td>
...
</tr>
<tr class="cart_item odd cancelled_line_item">
<td class="status_col">
<div class="first_row status">
Processing
</div>
<div class="second_row isbn">
9781111221294                                         <---- This is what I'm after
<br>
5606639
</div>
</td>

 Each of the highlighted rows above is a line item on an order and every line item will fall under either cart_item odd cancelled_line_item or cart_item even cancelled_line_item but because of various other elements the tr[x] value is completely dynamic. Large orders can have as many as a dozen of each one of those classes. If the name of the tr class wasn't used more than once I could easily get the Xpath with something like:

_FFXpath("html/body/div[3]/div[3]/div[3]/div[1]/table/tbody/tr[@class='cart_item odd cancelled_line_item']//td[1]/div[2]", "textContent" ,9)

But since there are multiple matches under that class on any order with 3 or more line items I can't seem to get the path for anything other than the first value found. If I change the parameters for _FFXpath from "textContent", 9 to "", 10 I can get a count so I know it's detecting multiple ISBN's, but I can't seem to find a way to return all of the xpath values for all line items.

I'm sure I'm missing something obvious here. Any help would be greatly appreciated.

Thank you!

[Edited for clarity)
 

Edited by Gonnosuke

Share this post


Link to post
Share on other sites



This should grab your collection, which you would then need to loop through to get the text.

"//tr[contains(@class,'cancelled_line_item')]//div[@class='second_row isbn']"


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This should grab your collection, which you would then need to loop through to get the text.

"//tr[contains(@class,'cancelled_line_item')]//div[@class='second_row isbn']"

Thank you so much for the accurate and blazing fast response! Worked great.

In case it might be useful to someone in the future, I just wanted to mention that _FFXpath(".//tr[contains(@class,'cancelled_line_item')]//div[@class='second_row isbn']", "textContent",7) outputs the results to an array for easy access.

Edited by Gonnosuke

Share this post


Link to post
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
Sign in to follow this  
Followers 0