0

我如何断言 . containsText不区分大小写Nightwatch.js?例如,我odin在谷歌上搜索“球体”。搜索结果有很多可能性,比如'Odin Sphere''odin sphere''ODIN SPHERE'等等,我只想用'odin sphere'来断言。这是我写的代码。

module.exports = {
    beforeEach: browser => {
        browser.url('https://www.google.com/')
    },
    after: browser => {
        browser.end()
    },
    'Search test': browser => {
        browser
            .setValue('input[name="q"]',['odin sphere',browser.Keys.ENTER])
            .waitForElementVisible('#res')
            .pause(5000)
            .verify.containsText('#res','Odin Sphere')
    }

}```

Thanks in advance!
4

1 回答 1

-1

https://nightwatchjs.org/api/#assert-containsText

用法:

this.demoTest = function (browser) {
  browser.assert.containsText("#main", "The Night Watch");
};
于 2020-10-19T19:55:03.000 回答