Java 我无法获取以下html代码的xpath
我正在尝试获取以下HTML代码的XPath,但是Java 我无法获取以下html代码的xpath,java,selenium-webdriver,xpath,Java,Selenium Webdriver,Xpath,我正在尝试获取以下HTML代码的XPath,但是 Exception in thread "main" org.openqa.selenium.ElementClickInterceptedException 发生错误 我试过这个- driver.findElement(By.xpath("//li/a[@href='#home']")).click(); HTML 看来您需要: 等待,直到这非常确定您可以右键单击并在中复制xpathchrome@KevinGlasson,我的操作与您告
Exception in thread "main" org.openqa.selenium.ElementClickInterceptedException
发生错误
我试过这个-
driver.findElement(By.xpath("//li/a[@href='#home']")).click();
HTML
看来您需要:
非常确定您可以右键单击并在中复制xpathchrome@KevinGlasson,我的操作与您告诉我的相同,但它在线程“main”org.openqa.selenium.element ClickInterceptedException中给出了以下错误异常:元素单击intercepted:元素在点(560358)处不可单击。其他元素将收到单击:…请提供代码示例文本而不是图像。一定要用完整的错误信息更新问题。我在这里只是猜测,因为我需要网站和我的电脑来解决它。但是,当您尝试时,页面是否可能没有完全加载。单击()
它?很好!那是因为它还没有加载
<a class="nav-link active show" data-toggle="tab" href="#home" role="tab" aria-selected="true">
<svg class="olymp-register-icon">
<use xlink:href="top10allthings.com/theme/app/svg-icons/sprites/…">
<svg id="olymp-register-icon" viewBox="0 0 37 32">
<title> register-icon </title>
</svg>
</use>
</svg>
<div class="ripple-container"> </div>
</a>
WebDriverWait wait = new WebDriverWait(driver,10);
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.id("hellopreloader")));
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//a[@href='#home']"))).click();