API
Nightwatch的API分为四个部分
1.Expect
在browser实例上以.expect.element开头的BDD(行为驱动测试)风格的接口,0.7及以上版本nightwatch可用。通过.element方法传入一个selector(参考querySelector或者jq的语...
.switchWindow()
Change focus to another window. The window to change focus to may be specified by its server assigned window handle, or by the value of its name attribute.
To find out the window handl...
.getLocationInView()
Determine an element's location on the screen once it has been scrolled into view. Uses elementIdLocationInViewprotocol command.
Parameters:
Name
Type
description
selector
strin...
to have NightWatch to find text in a div.
browser.assert.containsText('#output', 'find me')
But how do I tell NightWatch to expect not to find text in an element?
browser.expect.element('#output'...
1) used the following strategy to iterate over DOM elements using Nightwatch:
// Executing a function in the application context.
client.execute(function () {
// Get elements by CSS selector.
v...