I am trying to close the panel window using selenium webdriver. But I can't handle this. When I click on close button, I got an exception as "Unable to locate Element".
HTML code:-
<a class="ui-dialog-titlebar-close ui-corner-all" role="button" href="#"> <span class="ui-icon ui-icon-closethick">close</span>
Here is the code:
WebElement containerEle = driver.findElement(By.tagName("iframe"));
driver.switchTo().frame(containerEle);
//driver.findElement(By.cssSelector("span.ui-icon.ui-icon-closethick")).click();
driver.findElement(By.xpath(".//*[@id='ext-gen4']/div[4]/div[1]/a/span")).click();
And find the attachment for your reference.
Thanks in advance.
答案 0 :(得分:0)
尝试点击JavascriptExecutor
: -
JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript("arguments[0].click();", element);
element
是您要点击的Web元素