7, Selenium error: Solution Element is not clickable at point of

Today encounter a problem when writing Selenium Java script, and then log into the system, to click on a menu on the left, but the execution to the statement Times the following error:

Firefox中报错如下:
  org.openqa.selenium.ElementClickInterceptedException: Element <div class="el-submenu__title"> is not clickable at point (115,358) because another element <div class="el-loading-mask is-fullscreen el-loading-fade-leave-active el-loading-fade-leave-to"> obscures it

Error means: can not click this element, because masked another div (obscure) lived.

Chrome 中报错如下:
  org.openqa.selenium.WebDriverException: unknown error: Element <div class="el-submenu__title" style="padding-left: 20px;">...</div> is not clickable at point (115, 358). Other element would receive the click: <div class="el-loading-mask is-fullscreen el-loading-fade-leave-active el-loading-fade-leave-to" style="z-index: 2000;">...</div>
  (Session info: chrome=67.0.3396.99)

Error means: can not click this element, the other a div element receives the click.

Solution one:

Ideas: first use invisibilityOf wait masked div disappear, and then use the element elementToBeClickable wait to click to reach clickable.

Example:

// to click on the left menu elements
WebElement LeftMenu = driver.findElement (By.xpath ( "xpath"));
// hide the div element
WebElement ObscureDiv = driver.findElement (By.xpath ( " // div [@class = 'EL-loading-mask iS-Fullscreen-Fade-EL-loading the Leave-EL-loading the Active-Fade-to-the Leave'] "));
// use the display wait, div waiting to cover up the disappearance of
WebDriverWait wait = new WebDriverWait (Driver, 60);
wait.until (ExpectedConditions.invisibilityOf (ObscureDiv));
// wait for the menu to the left clickable
wait.until (ExpectedConditions.elementToBeClickable (LeftMenu));
// performed again after clicking
LeftMenu .click ( );

Solution two:

Idea: to conceal the div is possible to do some operations, the will disappear, so perform a page refresh after you log in, the div can disappear.

          And then wait for the menu to the left to clickable state.

Example:

Before the login code //
// After logging plus wait time, and once the page is refreshed
Thread.sleep (3000);
driver.navigate () Refresh ();.
// to click on the left menu elements
WebElement LeftMenu = driver. findElement (By.xpath ( "XPath"));
// wait for the menu to the left clickable
WebDriverWait the wait = new new WebDriverWait (Driver, 60);
wait.until (ExpectedConditions.elementToBeClickable (LeftMenu)); 
// performed again after click 
LeftMenu .click ();

Guess you like

Origin www.cnblogs.com/zengfh/p/12288049.html