谷歌搜索url的xpath问题没有内容

谷歌搜索url的xpath问题没有内容,xpath,Xpath,正在尝试获取搜索的url部分www.youtube.com/ 使用此xpath,但没有输出 .//*[@id='rso']/li[1]/div/div[2]/div[1]/cite 我还尝试使用css路径解决同一问题css:div[aria label='Result details']+div>div-cite。 顺便说一句,你的xpath对我来说很好。例如,如果您使用selenium检索文本,那么在本例中应该编写xpath=./,因为它通过前面的/符号将选择器识别为xpath。另外/*[@

正在尝试获取搜索的url部分www.youtube.com/

使用此xpath,但没有输出

.//*[@id='rso']/li[1]/div/div[2]/div[1]/cite

我还尝试使用css路径解决同一问题

css:
div[aria label='Result details']+div>div-cite

顺便说一句,你的xpath对我来说很好。例如,如果您使用selenium检索文本,那么在本例中应该编写
xpath=./
,因为它通过前面的
/
符号将选择器识别为xpath。另外
/*[@id='rso']/li[1]/div/div[2]/div[1]/cite//text()
将返回三个文本节点
www.
youtube
.com/

工作正常。您使用什么工具选择URL以及如何选择?向我们展示代码,我们热爱代码。