无法在GUI中单击“添加"按钮(错误:其他元素将获得点击) [英] Unable to click on 'Add' button in GUI (Error: Other element would receive the click)
问题描述
我试图单击'Add'
按钮,但出现以下错误消息:
I am trying to click on 'Add'
button but I am getting the following error message:
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown
error: Element <img src="theme/catalogSiemens/images/btn/btnBackCatalog.png"
alt="Zurück" title="Zurück"> is not clickable at point (53, 57). Other
element would receive the click: <div id="updateIndicator"
class="waitVisible"></div>
(Session info: chrome=58.0.3029.110)
(Driver info: chromedriver=2.29.461591
(62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.10586
x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 581 milliseconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'P3B-BQHT7R1', ip: '10.222.132.78', os.name: 'Windows
10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false,
mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome=
{chromedriverVersion=2.29.461591 (62ebf098771772160f391d75e589dc567915b233)
我的代码是:
driver.findElement(By.linkText("CMT Desigo CC")).click();
driver.findElement(By.linkText("Basis")).click();
driver.findElement(By.xpath("//img[@alt='In den Einkaufswagen
legen']")).click();
System.out.println("Item 1 added");
driver.findElement(By.xpath("//img[@alt='Zurück']")).click();
HTML是:
<a onclick=" if (document.referrer &&
document.referrer.indexOf('cameleonUI') > -1){if
(Prototype.BrowserFeatures.isAndroid) {history.back();} else {if
(document.referrer.startsWith(document.baseURI))
{location.href=document.referrer; } else {/* do nothing, too risky
*/}}}else{goBack('close.do?S_moduleContextId=cat');}; return false;
"
id="tile282_0"
actionName="BACK"
href="#"
target="_blank"
class="" > <img
src="theme/catalogSiemens/images/btn/btnBackCatalog.png" alt="Zurück"
title="Zurück" /> </a>
任何建议将不胜感激. 还请告知我是否需要更多信息. 预先感谢.
Any suggestions will be appreciated. Also let me know if more information is needed. Thanks in advance.
推荐答案
我认为先前的解决方案解决了该问题,但是为了不使这种行为再次随机发生,您将不得不增加等待时间并重新运行它一次以确保等待时间足够,因为每次运行代码时页面元素加载都不相同
I think previous solution solved the problem but in order not to have this behavior again randomly you will have to increase the wait time a little bit and re run it more than one time to be sure that the wait time is enough as the page elements loading will not be the same each time you run your code
您可以通过将10增大为15或20秒来实现:
You can do so by increasing the 10 to be 15 or 20 seconds:
WebDriverWait wait2 = new WebDriverWait(driver, 20);
WebElement element2 = wait2.until(ExpectedConditions.elementToBeClickable(By.xpath("//img[@alt='Zurück']")));
element2.click();
这篇关于无法在GUI中单击“添加"按钮(错误:其他元素将获得点击)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!