I'd like to get the hotel name in Xpath from the OTA web page.
//*[@id="property-critical-root"]/div/div[3]/div[2]/div[2]/div[2]/div[2]/div[1]/h1
I'm at a loss because I don't know how to describe it after .
web-scraping xpath
Pass the node set to string()
to make the XPath evaluation result a string.If the node set is an element, it is a concatenation of the descendant text of the element.
string (//*[@id abbreviation/h1)
By the way, if you look at the site briefly, the following simple formula seems to be fine.
string (//h1[@data-selenium="hotel-header-name"])
© 2024 OneMinuteCode. All rights reserved.