【发布时间】:2021-09-13 11:56:46
【问题描述】:
网站网址:https://staging.corporatehousingbyowner.com/
嗨, 我无法通过 Selenium Webdriver with Java 找到并单击 UL > li 中的以下按钮。 使用 Chrome 驱动程序执行自动执行。
<ul>
<li><a class="list-your-prop" href="/dashboard/properties/add/">List Your Property</a></li>
<ul/>
已经尝试了以下解决方案。
1:
WebElement element = driver.findElement(By.linkText("List Your Property"));
element.click();
2:
WebElement element = driver.findElement(By.className("menu-text"));
String elementText = element.getText();
3:
WebElement element = driver.findElement(By.xpath("//li[contains(@class,'list-your-prop')]/ul/li/a"));
element.click();
4:driver.findElement(By.cssSelector("body > header:nth-child(1) > nav:nth-child(4) > div:nth-child(1) > div:nth-child(2) > ul:nth-child(2) > li:nth-child(4) > a:nth-child(1)")).click();
[网页亮点][1] [1]:https://i.stack.imgur.com/FH2LR.png
请帮助,提前致谢。
【问题讨论】:
标签: java selenium selenium-webdriver selenium-chromedriver