[使用量角器/ Java脚本自动执行Angular时元素点击被拦截的错误

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

单击按钮时出现以下错误:失败:元素单击被拦截:元素...在点(1383,73)处不可单击。其他元素将获得点击:...

代码:describe('xyz应用程序成功登录',函数(){

it('Launching Application', function () {
    browser.waitForAngularEnabled(false); 
    var menuButton = element(by.xpath('//span[.="Today"]'));
    browser.get('xyz-url')
    browser.manage().window().maximize();
    console.log('Beta Application launched successfully')
    browser.sleep(8000)

    menuButton.click();
    browser.sleep(2000);
});

})

angular protractor
1个回答
0
投票

有几个问题。我通常尝试等待元素被单击或使用javascript单击它。

static readonly EC = protractor.ExpectedConditions;
browser.wait(EC.elementToBeClickable(menuButton);
menuButton.click();

browser.executeScript('arguments[0].click();', menuButton);
© www.soinside.com 2019 - 2024. All rights reserved.