Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Given the circumstances that you describe, you are forced to verify one of two conditions:</p> <ol> <li>Is the element that you want to click clickable?</li> <li>Is the reason that blocks the clicks still present?</li> </ol> <p>Normally, if the <code>WebDriver</code> is able to find the element and it is visible, then it is clickable too. Knowing the posible reasons that might block it, I would rather choose to verify those reasons. Besides, it would be more expressive in the test code: you clearly see what you are waiting for, <em>what</em> you are checking before clicking the element, instead of checking the "clickability" with no visible reason for it. I think it gives one (who reads the test) a better understanding of what is (or could be) actually going on.</p> <p>Try using this method to check that the loading image is not present:</p> <pre><code>// suppose this is your WebDriver instance WebDriver yourDriver = new RemoteWebDriver(your_hub_url, your_desired_capabilities); ...... // elementId would be 'loadingPanel' boolean isElementNotDisplayed(final String elementId, final int timeoutInSeconds) { try { ExpectedCondition condition = new ExpectedCondition&lt;Boolean&gt;() { @Override public Boolean apply(final WebDriver webDriver) { WebElement element = webDriver.findElement(By.id(elementId)); return !element.isDisplayed(); } }; Wait w = new WebDriverWait(yourDriver, timeoutInSeconds); w.until(condition); } catch (Exception ex) { // if it gets here it is because the element is still displayed after timeoutInSeconds // insert code most suitable for you } return true; } </code></pre> <p>Perhaps you will have to adjust it a bit to your code (e.g. finding the element once when the page loads and only checking if it is displayed).</p> <p>If you are not sure when exactly the loading image comes up (though I suppose you do), you should call this method before every click on elements that would become "unclickable" due to the loading image. If the loading image is present, the method will return <code>true</code> as soon as it disappears; if it doesn't disappear within 'timeoutInSeconds' amount of time, the method will do what you choose (e.g. throw an exception with specific message). </p> <p>You could wrap it together like:</p> <pre><code>void clickSkippingLoadingPanel(final WebElement elementToClick) { if (isElementNotDisplayed('loadingPanel', 10)) { elementToClick.click(); } } </code></pre> <p>Hope it helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload