Reputation: 42634
I am using nightwatch for integration test and it failed to find one of my dom element. Below is my html code:
<body>
<div style="position: absolute; overflow: hidden; height: 24px;">
<div class="GPNWDJGEV" style="width: 24px; height: 24px;">
</div>
<div id="gwt-debug-MenuItem" style="width:100px;height:100px;">
</div>
</div>
</body>
Below is nightwatch code.
module.exports = {
'Connection Test' : function (browser) {
browser
.url('file:///tmp/test.html')
.waitForElementVisible("#gwt-debug-MenuItem", 5000)
.pause(1000)
.end();
}
};
I got below error when running this test case:
✖ Timed out while waiting for element <#gwt-debug-MenuItem> to be visible for 5000 milliseconds. - expected "visible" but got: "not visible"
I am able to find other dom element but failed to find this one #gwt-debug-MenuItem
. What is the problem with this code?
Upvotes: 2
Views: 1477
Reputation: 51009
It looks like the element is not really visible. Try waiting for its presence instead with waitForElementPresent
module.exports = {
'Connection Test' : function (browser) {
browser
.url('file:///tmp/test.html')
.waitForElementPresent("#gwt-debug-MenuItem", 5000)
.pause(1000)
.end();
}
};
Upvotes: 6