Hi need advice to find the xpathonurl URL inside span onclick="windows.open..
I use this =XPathOnUrl(B19;"//*[@id='dealerdetail-page']/div[1]/div/div[2]/div/span") but the result is text : Gmap Location
I want the result is the google map url (https://map.google.com/?q=..) not the text
<span title="Petunjuk Arah" onclick="window.open('http://maps.google.com/?q=-6.249028,106.996952', '_blank')">Gmap Location</span>
CodePudding user response:
If you only have access to xpath 1.0, you can try:
//span/substring-before(substring-after(./@onclick,"'"),"'")
If you have xpath 2.0, try:
//span/tokenize(@onclick,"'")[2]
CodePudding user response:
substring-before(
substring-after(
//*[@id='dealerdetail-page']/div[1]/div/div[2]/div/span/@onclick,
"'"
),
"'"
)
translation: the value of the onclick
attribute of the span
, discarding everything before the first '
character, and after the next '
character.