量角器+镀铬驱动器:元素在点处不可单击 [英] Protractor + chrome driver: Element is not clickable at point

查看:84
本文介绍了量角器+镀铬驱动器:元素在点处不可单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使基本的量角器测试正常工作时遇到了一些麻烦.

Hi I am having some trouble getting a basic protractor test to work.

我的设置:

  • 我使用requirejs,所以我使用angular.bootstrap()而不是ng-app attr来初始化angular.根据量角器文档,此功能不被立即使​​用,但对于不涉及单击的测试似乎可以正常工作.
  • 量角器conf.json:

  • I use requirejs so I init angular using angular.bootstrap(), not the ng-app attr. According to protractor docs this is not supported out of the box, but seems to work fine for tests that don' involve clicking.
  • Protractor conf.json:

"use strict";
exports.config = {
    specs: '../E2ETests/**/*.js',
    chromeOnly: true,
    getPageTimeout: 30000,
    allScriptsTimeout: 30000
}

  • 我使用一些包装在指令中的第三方jquery插件,我怀疑这可能是问题的一部分.
  • 测试:

    "use strict";
    describe('When clicking should add stuff', function () {
        var ptor;
        beforeEach(function () {
            browser.get('https://localhost/myApp');
            ptor = protractor.getInstance();
        });
        it('add stuff', function () {
            // If I comment this, the test pass. 
            element(by.id('add-stuff-button')).click();
            // This does not matter fails on the line above..
            expect(browser.getTitle()).toBeDefined();
        });
    });
    

    错误:

    UnknownError: unknown error: Element is not clickable at point (720, 881). Other element would         receive the click: <div class="col-md-5 col-md-offset-5">...</div>
    (Session info: chrome=37.0.2062.124)
    (Driver info: chromedriver=2.10.267521,platform=Windows NT 6.1 SP1 x86_64)
    

    想法

    chromedriver确实找到了按钮,因为如果我更改id,它会抱怨找不到元素.因此,我认为问题在于按钮从其初始位置移动.由于element(***)函数应该等待angular完成,因此我怀疑它的第三方插件可能会干扰,因为它们可能不使用angular api的获取数据等.因此,angular认为已完成,但随后是第三方插件填充并移动东西.

    The chromedriver do find the button, because if I change the id it complains that no element is found. So I think the problem is that the button moves from its initial position. As the element(***) function should wait for angular to be done, I suspect that its the third party plugins that might interfere as they might not use angular api's fetching data etc. So angular think its done but then the third party plug populates and moves stuff around.

    任何想法怎么办? 如果是第三方插头出了问题,我可以以某种方式告诉Angle第三方资料正在发生,然后在完成时告诉它吗?

    Any ideas what to do? If the third party plugs is the problem, can I somehow tell angular that third party stuff is going on and then later tell it when its done?

    Thx 溴 Twd

    Thx Br Twd

    推荐答案

    您应在配置文件中设置窗口大小

    You should set window size in your config file

    onPrepare: function() {
      browser.manage().window().setSize(1600, 1000);
    }
    

    这篇关于量角器+镀铬驱动器:元素在点处不可单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆