小编kgs*_*tew的帖子

setFindTimeout和pollUntil with Intern表示在初始页面加载时不可见的元素

我在让Intern 2等待元素出现时遇到问题.在Intern 1中,我 wait()用来设置页面的快速时间段,以便在某些用户操作之后等待元素出现.对于Intern 2,似乎setFindTimeout()应该总是告诉一个find()方法等待元素存在.我已经设置setFindTimeout()并尝试使用pollUntil来处理这些等待,但测试仍然失败,错误"元素不可见".

这是一个示例测试,它使用与我的实际测试相同的要求,并且正在寻找在此页面加载后5秒出现的元素Id .

define([
'intern!object',
'intern/chai!assert',
'require',
'tests/util',
'intern/dojo/node!leadfoot/Command',
'intern/dojo/node!leadfoot/Session',
'intern/dojo/node!leadfoot/helpers/pollUntil'
], function (registerSuite, assert, require, util, Command, Session, pollUntil) {

registerSuite([   
    {
        name: 'testing_find_by_wait',

        test_create_form_on_web: function() {
            console.log('Create a form with account, number, number and formula fields')

            return this.remote
                .setFindTimeout(10000)
                .setWindowSize(1280, 960)
                .get("http://www.kgstew.com/waittest.html")
                .then(pollUntil('return document.getElementById("demo")', 10000))
                .findById('demo')
                    .click()
                    .end()

        }
    }
]);
});
Run Code Online (Sandbox Code Playgroud)

javascript intern

6
推荐指数
1
解决办法
1490
查看次数

标签 统计

intern ×1

javascript ×1