OpenQA.Selenium.ElementClickInterceptedException : 요소 클릭 차단됨 : 요소 <button class = "button">은 (x, y) 지점에서 클릭 할 수 없습니다.

프레이르 곤잘레스

모달 대화 상자 에서 버튼을 클릭하려고하는데 클릭 할 때가되면 다음 오류가 발생합니다.

OpenQA.Selenium.ElementClickInterceptedException : element click intercepted: Element <button onclick="Activar(193);" class="button mx-1" title="Recover">...</button> is not clickable at point (1206, 319). Other element would receive the click: <div class="ui-widget-overlay" style="width: 1349px; height: 613px; z-index: 1001;"></div>

대기 도우미를 사용해야한다는 것을 알고 있지만 사용 방법을 정확히 모르겠습니다. 이것은 대기 도우미가있는 내 코드입니다.

 public ConfigurationUsuario HabilitarConfiguracion()
        {
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(20));
            iconoActivar.Click();
            driver.SwitchTo().ActiveElement();
            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(By.XPath("//button[@title='Recover']"))).Click();
            driver.FindElement(By.XPath("//button[@title='Recover']")).Click();
            return new ConfigurationUsuario(driver);
        }

아마도 대기 도우미를 사용하는 방법을 모르기 때문일 것입니다.하지만 테스트는 20 초 동안 기다리지 않고 모달 대화 상자에서 2-3 초 후에 닫히므로 누군가 나를 도울 수 있으면 정말 평가하겠습니다.

Dazed

이 시도:

표시된 요소를 기다리십시오.

전의. WaitForElementDisplayed_byXPathTime ( "// input [@ id = 'id']");

    public static void WaitForElementDisplayed_byXPathTime(string value)
    {
        try
        {
            var wait = new WebDriverWait(driver, new TimeSpan(0, 0, 30));
            wait.Until(webDriver => driver.FindElement(By.XPath(value)).Displayed);
        }
        catch (Exception) { throw; }
    }

그런 다음 팝업으로 전환하십시오. 솔직히 말해서 이것이 필요하지 않을 수도 있습니다. 모든 팝업을 전환해야하는 것은 아닙니다.

        public static string SwitchToPopup()
    {
        var mainHandle = driver.CurrentWindowHandle;
        var handles = driver.WindowHandles;

        foreach (var handle in handles)
        {
            if (mainHandle == handle)
            {
                continue;
            }
            driver.SwitchTo().Window(handle);
            Thread.Sleep(1000);
            break;
        }
        var result = Url;
        return result;
       
    }

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관