GrayFox
GrayFox

Reputation: 185

xPath union statement with functions

thanks in advance for reading.

I'm using $x() xPath evaluator of Chrome console.

I need to match something shaped like $x("e1 | e2").

In my case:

They both works in the single way but if i want to combine them I just get stuck in

"Failed to execute 'evaluate'..."

PS The problem is e2 function substring-after, without it the union works.

Any Ideas? Here are the 2 sources i'm trying to extract:

Thanks again :)

Upvotes: 0

Views: 610

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167706

Based on your comments that you want string values and expect only one of those expressions to find something on the same page you could simply try

var result = $x("string((//div[@class='seven columns omega']//form//div[@class='items_left']//text())[2])") + $x("(substring-after(//div[@class='seven columns omega']//span[@class='sold_out']/text(),' - '))")

Upvotes: 1

Related Questions