量角器:元素不可交互

问题描述 投票:0回答:1

我的测试由于错误而失败:

元素不可交互失败:元素不可交互(会议信息:chrome = 79.0.3945.130)(驱动程序信息:chromedriver = 79.0.3945.16(93fcc21110c10dbbd49bbff8f472335360e31d05-refs / branch-heads / 3945 @ {#262}),platform = Windows NT 10.0.18362 x86_64)

一些信息硒独立3.141.59壁虎驱动程序v0-26.0Google Chrome版本79.0.3945.130(正式版本)(64位)该部分代码用于非角度页面。

您可以在下面的代码中看到,我添加了browser.sleep(),但没有解决我的问题导致问题的元素在最后一行(id('column_header_44)

  it('should compare the space size stored, against the value stored in app', function () {
        browser.driver.manage().window().maximize();
        browser.sleep(2000);
        browser.switchTo().frame(element(by.className('designer-client-frame')).getWebElement());
        browser.sleep(2000);
        element(by.css('div:nth-child(1) > .ms-Link > .ms-navbar-node-caption > span')).click();//click in Item
        browser.sleep(2000);
        element(by.css('.horizontal-flex-container-item-layout--paigVxanvxFrIsRy2U02r:nth-child(3) .thm-head-a2-font-size-1--medflat > span')).click();//click in process
        browser.sleep(2000);
        element(by.css('.ms-ContextualMenu-item:nth-child(1) .thm-popp-a2-font-stack-2--minflat')).click();//click in Time phased
        browser.sleep(3000);
       element(by.id('column_header_44')).click();//click on item no
        browser.sleep(3000);

    })
protractor
1个回答
0
投票
您应避免将browser.sleep用作显式等待方法。请改用量角器特定的方法。在单击之前使用等待的一种好方法是等待元素出现在html DOM(presenceOf)中,然后等待其可单击(elementToBeClickable),最后执行单击操作:

it('should compare the space size stored, against the value stored in app', async () => { const EC = protractor.ExpectedConditions; const your_element = element(by.id('column_header_44')); await browser.wait(EC.presenceOf(your_element)); await browser.wait(EC.elementToBeClickable(your_element)); await your_element.click(); });

© www.soinside.com 2019 - 2024. All rights reserved.