为什么Webdriver不能通过xpath找到一个元素?

Why can't Webdriver find an element through xpath?

我的代码找不到 link XPath 的注册。使用 CSSSelector.

同样的问题
driver = new ChromeDriver(options);
driver.Navigate().GoToUrl("https://www.goldtoe.com/state/landing");         
var LoginLink = driver.FindElement(By.XPath("//li[@class='hidden-xs myAccountMenu']//a[contains(text(),'Sign In/Register')] "));
LoginLink.Click();

消息:

> OpenQA.Selenium.NoSuchElementException : no such element: Unable to
> locate element: {"method":"xpath","selector":"//li[@class='hidden-xs
> myAccountMenu']//a[contains(text(),'Sign In/Register')] "}   (Session
> info: chrome=74.0.3729.169)   (Driver info: chromedriver=74.0.3729.6
> (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Windows
> NT 10.0.17763 x86_64)

我认为 'Sign In/Register' 字符串需要一个转义字符,特别是 '/' 特殊字符。所以,试试 'Sign In\/Register' 吧。使用'\'作为转义字符。