this question has answer here:
i have link need scraping using xpath , domdocument on table. need to name of chemmical, link , part. i've tried using xpath helper in chrome no luck, doesn't make right query. ideas i'm doing wrong? i'm using query: //table/tbody/tr/td/a
i able data looking using xpath helper in chrome in following manner (these lines typed chrome console):
all chemicals / first chemical:
> allchemicals = $x("descendant::tr/td[(position() =1)]") > firstchemical = allchemicals[0].innertext
all links / first link:
> alllinks = $x("descendant::tr/td[(position() =1)]/a") > firstlink = alllinks[0].href
all parts / first part:
> allparts = $x("descendant::tr/td[(position() =2)]") > firstpart = allparts[0].innertext
hope helps.
Comments
Post a Comment