无法单击yui中的按钮,其中IDE显示其命令为clickAndWait

时间:2017-05-17 13:20:07

标签: selenium-webdriver

我想点击按钮,我会在下一页重定向。在IDE中,它的命令是“clickAndWait”。但我无法做同样的事情。

我收到以下错误:

Exception in thread "main" org.openqa.selenium.WebDriverException: unknown 
error: Element <img src="theme/catalogSiemens/images/btn/btnViewQuote.png" 
alt="Zurück" title="Zurück"> is not clickable at point (1093, 702). Other 
element would receive the click: <div class="content">...</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: 556 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), 
userDataDir=C:\Users\KRUTIK~1.KOM\AppData\Local\Temp\scoped_dir9296_19593}, 
  takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, 
handlesAlerts=true, hasTouchScreen=false, version=58.0.3029.110, 
platform=XP, browserConnectionEnabled=false, nativeEvents=true, 
acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, 
browserName=chrome, takesScreenshot=true, javascriptEnabled=true, 
cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]
Session ID: e6f12e7417f09729f4a071af68f50721

我的代码在哪里:

WebDriverWait wait2 = new WebDriverWait(driver, 30);
    WebElement element = 
wait2.until(ExpectedConditions.elementToBeClickable(By.xpath("
(//img[@alt='Zurück'])[2]")));
    element.click();

它的HTML是:

<a onclick="                
                            freezeUI();
                    "
                    id="tile238_0"
                    actionName="CLOSE"     href="close.do?
S_moduleContextId=cat&goTo=cart.CartPage"      class=""  >        <img 
src="theme/catalogSiemens/images/btn/btnViewQuote.png" alt="Zurück" 
title="Zurück" />  </a>

对此的任何建议将不胜感激。 谢谢。

1 个答案:

答案 0 :(得分:0)

你有没有尝试让硒等待更多?有时简单但有效:)