Jump to content
Sign in to follow this  
janganan

[ask] _FFXpath problem [SOLVED]

Recommended Posts

$baseurl = "http://www.amazon.com/s/ref=sr_nr_n_15?rh=n%3A172282%2Cn%3A!493964%2Cn%3A541966%2Ck%3Amouse%2Cn%3A172584&bbn=541966&keywords=mouse&ie=UTF8&qid=1358054852&rnid=541966";

_FFStart()
_FFOpenURL($baseurl)

$aArray = _FFXpath(".//div[contains(@id,'result_')]/@name","",6);

result of _ArrayDisplay($aArray) is like this, so how to handle [obj Attr] ???Posted Image

Edited by janganan

Share this post


Link to post
Share on other sites

I just wanna extract this div from $baseurl

<div id="result_1" class="fstRowGrid prod" name="B00AAUDRIM">

try to using _FFXpath but return array that i dont know how to deal with this array.

actually i just wanna get

name="BXXXXXXXX"

Edited by janganan

Share this post


Link to post
Share on other sites

Taking a different approach:

#include <Inet.au3>
#include <Array.au3>
$baseurl = "http://www.amazon.com/s/ref=sr_nr_n_15?rh=n%3A172282%2Cn%3A!493964%2Cn%3A541966%2Ck%3Amouse%2Cn%3A172584&bbn=541966&keywords=mouse&ie=UTF8&qid=1358054852&rnid=541966"
$sHTML = _INetGetSource($baseurl)
$aArray = StringRegExp($sHTML, '<div.*?id="result_.*?".*?name="(.*?)".*?>', 3) ; Returns just name
;$aArray = StringRegExp($sHTML, '<div.*?id="result_.*?".*?(name=".*?").*?>', 3) ; Returns name="..."
_ArrayDisplay($aArray)

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...