[英]Get DOM element in DalekJS
I have a problem with my DalekJS test. 我的DalekJS测试有问题。 I would like get a value from a DOM element, but I don't know how to do so. 我想从DOM元素中获取一个值,但我不知道该怎么做。
This is what I've tried: 这是我尝试过的:
test.open('http://www.1915-1918.org/memoriale/')
.waitForElement('.numItemsFil')
.execute(function () {
this.assert.ok((document.getElementsByClassName('numItemsFil')[0].innerText ===
document.getElementsByClassName('item').length));
})
.done();
Have you tried using the assert.text(...) method? 您是否尝试过使用assert.text(...)方法?
Something like this should work I think: 我认为这样的事情应该起作用:
test.open('http://www.1915-1918.org/memoriale/')
.waitForElement('.numItemsFil:first-child')
.assert.text('.numItemsFil:first-child', document.getElementsByClassName('item').length, 'Text matches item count')
.done();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.