UnknownError: unknown error: Element is not clickable at point (713, 6). Other element would receive the click: <div class="container">...</div>

UnknownError: unknown error: Element is not clickable at point (713, 6). Other element would receive the click: <div class="container">...</div>

我遇到了非常奇怪的错误。在我的测试中,我首先导航到 angularjs.org。然后我将 sendKeys() 发送到一个名为 "JavaScript Projects" 的输入字段,其中包含过滤器。之后,我单击一个复选框并将待办事项标记为完成。然而,在这样做时,它得到了错误,

UnknownError: unknown error: Element is not clickable at point (713, 6). Other element would receive the click: ... (Session info: chrome=43.0.2357.81)

如果我颠倒上面的执行顺序,不会发生错误。

这是我的代码

var util = require ('util');
describe ("Page object text", function() {
var homepage = require('../pages/angularjs_page.js');
it ("Should mark an item done", function() {
    homepage.get();
    browser.sleep(2000);
    homepage.searchText('jquery');
    homepage.markDoneTodo(0);
});  
});

这是页面对象代码:

var angularjs_page = function() {
    this.get = function() {
        browser.get('http://www.angularjs.org');
    };
    this.markDoneTodo = function(index) {
        element.all(by.repeater('todo in todoList.todos'))
            .get(index)
                .element(by.model('todo.done'))
                    .click();
    };
    this.searchText = function(txt) {
        element(by.model('projectList.search')).sendKeys(txt);
    };
};
module.exports = new angularjs_page();

最大化浏览器 window 无效。 Sleep() 似乎没有引起这个问题。在两者之间插入一个 sendKey() 方法可以正常工作。

browser.sleep(2000);
    homepage.searchText('jquery');
    homepage.enterName("Hello World");
    homepage.markDoneTodo(0);

那么,依次执行 searchText() 和 markDoneTodo() 方法有什么问题?

发现问题 结果是静态顶部导航菜单栏与复选框重叠。滚动是最好的解决方法吗?如何解决?

使用滚动解决了问题。

browser.executeScript('window.scrollTo(0,document.body.scrollHeight)');