简体   繁体   中英

how can I select all li elements with a span of text value equal to a number using xpath not absolute?

the link is: https://www.yelp.com/search?find_desc=burger&find_loc=Louisville%2C+KY&ns=1 and if you right click and inspect the '1' besides Six fork's burger, the xpath is /html/body/div[1]/div[4]/div/div[1]/div[1]/div[2]/div[2]/ul/li[6]/div/div/div/div[2]/div[1]/div/div[1]/div/div[1]/div/div/h4/span with span text has value of a number,

I want to create an xpath which selects all 'li' tag with 'span' that has numbers value of text, that is child of 'li'

Try using an xpath expression like

//ul/li[@class="lemon--li__373c0__1r9wz border-color--default__373c0__3-ifU"]//h4/span/text()[1]

and see if it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM