@Evgeniel

Почему возникает ошибка org.openqa.selenium.ElementClickInterceptedException: element click intercepted?

Код page object
package pages;

import helpers.PageObjectUtils;
import helpers.Waiters;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

import java.io.IOException;

public class CreatingAssessment {
    /**
     * Browser driver.
     */
    private WebDriver driver;

    /**
     * Page url.
     */
    private static final String ASSESSMENT_URL = "/login";

    /**
     * Login input element.
     */
    @FindBy(css = "input[ng-model='vm.login']")
    private WebElement loginEditElement;

    /**
     * Password input element.
     */
    @FindBy(css = "input[ng-model='vm.password']")
    private WebElement passwordEditElement;

    /**
     * Login submit button.
     */
    @FindBy(css = "button[ng-click='vm.log()']")
    private WebElement loginButtonElement;

    /**
     *Open fab submit button.
     */
    @FindBy(css = "button[ng-click='vm.openFab($event)']")
    private WebElement openFabButtonElement;

    @FindBy(css = "div[class='adding-area-item']")
    private WebElement openFabRuButtonElement;

    /**
     *Result submit button.
     */
    @FindBy(xpath = "//label[contains(.,'Новая оценка')]")
    private WebElement resultOpenFabRuButtonElement;

    /**
     * Project customer input element.
     */
    @FindBy(css = "textarea[ng-model='vm.project.customer']")
    private WebElement projectCustomerEditElement;

    /**
     * Project name input element.
     */
    @FindBy(css = "textarea[ng-model='vm.project.name']")
    private WebElement projectNameEditElement;

    /**
     * Project description input element.
     */
    @FindBy(css = "textarea[ng-model='vm.project.description']")
    private WebElement projectDescriptionEditElement;

    /**
     *Department submit.
     */
    @FindBy(xpath = "//md-checkbox[contains(.,'2017 Направление Аналитики')]")
    private WebElement departmentAnalytButtonElement;

    @FindBy(xpath = "//md-checkbox[contains(.,'2017 Направление функционального тестирования')]")
    private WebElement departmentQAButtonElement;

    @FindBy(xpath = "//md-checkbox[contains(.,'2017 Направление QA Automation')]")
    private WebElement departmentQAAButtonElement;

    /**
     *Language edit.
     */
    @FindBy(css = "md-radio-button[value='ru']")
    private WebElement languageButtomElement;

    /**
     *Expert search edit.
     */
    @FindBy(xpath = "//*[@id=\"input-36\"]")
    private WebElement expertSearchEditElement;

    @FindBy(xpath = "//*[@id=\"ul-36\"]/li[1]")
    private WebElement expertSearchButtomElement;

    /**
     *Edit about save.
     */
    @FindBy(xpath = "//span[contains(.,'Сохранить и добавить фазу')]")
    private WebElement editAboutButtonElement;

    /**
     * Page object constructor. Checks that page is open when created.
     * @param webDriver browser driver
     * @throws IOException when config file is not available
     * @throws IllegalStateException if page is not open now
     */
    public CreatingAssessment(final WebDriver webDriver) throws IOException,
            IllegalStateException {
        this.driver = webDriver;
        PageFactory.initElements(webDriver, this);
        if (!PageObjectUtils.checkPageIsPresentByUrl(webDriver, ASSESSMENT_URL)) {
            throw new IllegalStateException("Creating assessment is not present");
        }
    }

    /**
     * Authorization method.
     * @param userName login to input
     * @param password password to input
     * @return page object with estimates list
     * @throws IOException when config file is not available
     */
    public final EstimatesPage login(final String userName,
                                     final String password)
            throws IOException {
        Waiters.waitUntilAngularReady(driver);
        loginEditElement.sendKeys(userName);
        passwordEditElement.sendKeys(password);
        loginButtonElement.click();
        return new EstimatesPage(driver);
    }

    public final String creating(final String projectCustomer,
                                 final String projectName,
                                 final String projectDescription,
                                 final String expertSearch) throws InterruptedException, IOException {
        Waiters.waitUntilAngularReady(driver);
        openFabButtonElement.click();
        openFabRuButtonElement.click();
        Thread.sleep(3000);
        String result = resultOpenFabRuButtonElement.getText();
        languageButtomElement.click();
        departmentQAButtonElement.click();
        departmentAnalytButtonElement.click();
        departmentQAAButtonElement.click();
        projectCustomerEditElement.sendKeys(projectCustomer);
        projectNameEditElement.sendKeys(projectName);
        projectDescriptionEditElement.sendKeys(projectDescription);
        expertSearchEditElement.sendKeys(expertSearch);
        expertSearchButtomElement.click();
        editAboutButtonElement.click();
        return result;
    }
}


код самого теста
package tests;

import helpers.DriverFactory;
import helpers.ParametersProvider;
import org.openqa.selenium.WebDriver;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import pages.CreatingAssessment;

import java.io.IOException;

/**
 * Test suite for creating an assessment.
 */
public class CreatingAssessmentTest {
    /**
     * Browser driver.
     */
    private WebDriver driver;

    /**
     * Suite setup.
     * @throws IOException when config file is not available
     */
    @BeforeMethod
    public final void setEnvironment() throws IOException {
        this.driver = DriverFactory.createDriver();
        String webUrl = ParametersProvider.getProperty("webUrl");
        driver.get(webUrl);
    }

    /**
     * Test case QAA-5.
     * @throws IOException when config file is not available
     */
    @Test(description = "QAA-5:Создание оценки")
    public final void creatingAssessment() throws IOException, InterruptedException {
        CreatingAssessment creatingAssessment = new CreatingAssessment(driver);
        String moderatorLogin = ParametersProvider.getProperty("moderatorLogin");
        String moderatorPassword = ParametersProvider.getProperty("Password");
        String projectCustomer = ParametersProvider.getProperty("projectCustomer");
        String projectName = ParametersProvider.getProperty("projectName");
        String projectDescription = ParametersProvider.getProperty("projectDescription");
        String expertSearch = ParametersProvider.getProperty("expertSearch");

        creatingAssessment.login(moderatorLogin, moderatorPassword);

        String resultCreating = creatingAssessment.creating(projectCustomer, projectName, projectDescription, expertSearch);
        Assert.assertEquals(resultCreating, "Новая оценка");

        //creatingAssessment.creatingAss(projectCustomer, projectName, projectDescription, expertSearch);
    }

    /**
     * Suite teardown.
     */
    @AfterMethod
    public final void tearDown() {
        driver.quit();
    }
}


когда просто запускаю тест возникает ошибка org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element ... is not clickable at point (508, 555). Other element would receive the click: ...

если дебажить пошагово, то ошибки такой нет
скажите пожалуйста в чем может быть проблема?
  • Вопрос задан
  • 95 просмотров
Решения вопроса 1
@1001001
Элемент не кликабельный в момент клика, поставьте задержку или ожидание https://www.seleniumhq.org/docs/04_webdriver_advan... elementToBeClickable
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
21 авг. 2019, в 18:58
100 руб./за проект
21 авг. 2019, в 18:32
5000 руб./за проект
21 авг. 2019, в 18:21
1000 руб./за проект