【发布时间】:2020-04-04 22:31:06
【问题描述】:
我正在尝试寻找这样的元素:
<use xlink:href="site.org/path/action#edit"></use>
通过使用此选择器的给定属性:
public static By ElementsSelector { get; set; } = By.CssSelector(@"use[xlink:href='site.org/path/action#edit']");
我通过以下方式找到元素:
Driver.FindElements(EditProfilePage.ElementsSelector)[0].Click();
但我得到一个例外:
OpenQA.Selenium.InvalidSelectorException: 'invalid selector: An invalid or illegal selector was specified
(Session info: chrome=78.0.3904.87)'
问题:如何找到具有给定xlink:href 属性的元素?
【问题讨论】:
-
用相关的 HTML 更新问题
-
@DebanjanB 完成。
标签: .net selenium svg xpath css-selectors