一切
xpath看起来都不错,只是语法上有些错误。你失踪
//了
xpath
正确
xpath的如下:
By by = By.xpath("//span[.='Settings']")
要么
By by = By.xpath("//span[text()='Settings']")
要么
By by = By.xpath("//div[@]/span"))
或者您可以
cssSelector用作:-
By by = By.cssSelector("div.settings-padding > span"))
使用上面的任何一个通过定位器,您都可以如下所示定位元素:
WebDriverWait wait = new WebDriverWait(driver, 10);WebElement el = wait.until(presenceOfElementLocated(by));
希望能帮助到你…:)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)