无法创建相当于 CSS 部分匹配为 `a[href*="https://stackexchange.com/"]` 的 Xpath

Unable to create Xpath equivalent to partial match of a CSS being `a[href*="https://stackexchange.com/"]`

我正在尝试获取:来自 https://whosebug.com/

的热门网络问题 Href

有没有等价于a[href*="https://stackexchange.com/questions?tab=hot"]

的Xpath
//a[Href*"https://stackexchange.com/questions?tab=hot"]

上面的下面是有效的...

//a[@href='https://stackexchange.com/questions?tab=hot']

我想要更具体并创建部分匹配...

所以像这样:

//acontains[@href='https://stacke']

//a[starts-with@href='https://stacke']

这可以用 xpath 实现吗?

//a[starts-with(@href='https://stacke') or contains(@href, 'https://stacke')] 

试试这个选择器:

//a[starts-with(@href, ('https://stackexchange.com/questions'))]