я получаю эту ошибку "org.openqa.selenium.ElementClickInterceptedException" - PullRequest
0 голосов
/ 05 июля 2019

загрузчик, имеющий div id = "preload", перекрывает все базовые элементы, поэтому Я не могу нажать на какие-либо элементы. Для этого я написал один метод

// this is the method before clicking on any element i need to call
Test{ 
public  String waitForElementNotVisible(int timeOutInSeconds, WebDriver driver, String elementXPath) { 
    if ((driver == null) || (elementXPath == null) || elementXPath.isEmpty()) { 

        return "Wrong usage of WaitforElementNotVisible()"; 
    } 
    try { 
        (new WebDriverWait(driver, timeOutInSeconds)).until(ExpectedConditions.invisibilityOfElementLocated(By 
        .xpath(elementXPath))); 
        return "null"; 
    } catch (TimeoutException e) { 
        return "Build your own errormessage..."; 
    } 
}

}

i have so many elements i don't want to call this method again and again 
for each 
element..if i wont call this method to each elements before click means i 
will get 
error like  "element click intercepted: Element <a href="http://stage.altechcrm.shrigowri.com/admin/inventory/create" class="btn btn-outline btn-success btn-sm">...</a> is not clickable at point (338, 307). Other element would receive the click: <div class="preloader" style="opacity: 0.733965;">...</div>"


//this is another class ,here i have called that method here only i wrote 
xpath for each element as of now i have 2 xpath

public class InventoryModule extends Test {

public static void main(String[] args) throws InterruptedException {
    //creating object of test class
        Test t1=new Test();

t1.waitForElementNotVisible(50,driver,LoaderXpath);
    driver.findElement(By.xpath("//a[contains(@href,'admin/inventory')]")).click();

    t1.waitForElementNotVisible(50,driver,LoaderXpath);
    driver.findElement(By.xpath("//a[contains(@href,'admin/inventory/create')]")).click();

} }

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...