Hi,
I have an error when I use the Expect.element.text.to.equal or Expect.element.text.to.contain in the ChromeDriver.
This is my test:
.navigate()
.waitForElementVisible('body', 1000);
project.expect.element('title').text.to.equal('Project title');
(project is my pageObject)
This test pass if I run the test with the GeckoDriver.
But with the ChromeDriver I have the following error:
Expected element <title> text to equal: "Project title" - expected "equal 'Project title'" but got: ""
I use [email protected]
Have you ever encountered this error?
Try using this custom Nightwatch command to achieve what you want:
https://github.com/maxgalbu/nightwatch-custom-commands-assertions/blob/master/es6/commands/waitForTitle.js
or, the transpiled version...
https://github.com/maxgalbu/nightwatch-custom-commands-assertions/blob/master/js/commands/waitForTitle.js
View the rest of the project here:
https://github.com/maxgalbu/nightwatch-custom-commands-assertions
Never had any issues with the expect syntax
project.expect.element('title').text.to.equal('Project title');
Did you tried to use the @ notation for your page-object elements ?
regards
~david
Same issue.
Using nightwatch v. 0.9.14, node.js v7.7.4, macOS v10.12.4, Selenium Server Standalone 3.3.1 on Java 8, ChromeDriver
Test code is:
module.exports = {
'step one': function(browser) {
browser
.url('https://www.pintux.it')
.waitForElementVisible('body', 5000);
browser.expect.element('title').to.be.present;
browser.expect.element('title').text.to.equal("Antonio Pintus' Home Page");
},
'step two': function(browser) {
browser
.click('a[href="http://jaranto.blospot.com"]')
.pause(5000);
browser.expect.element('title').to.be.present;
browser.expect.element('title').text.to.equal("a.p");
browser.end();
}
};
Error is:
Same issue for me. Any solution??
Same issue, any updates?
Also facing this issue...
Hi @beatfactor. Maybe you want reopen this issue?
Most helpful comment
Same issue.
Using nightwatch v. 0.9.14, node.js v7.7.4, macOS v10.12.4, Selenium Server Standalone 3.3.1 on Java 8, ChromeDriver
Test code is:
module.exports = {
'step one': function(browser) {
browser
.url('https://www.pintux.it')
.waitForElementVisible('body', 5000);
browser.expect.element('title').to.be.present;
browser.expect.element('title').text.to.equal("Antonio Pintus' Home Page");
},
'step two': function(browser) {
browser
.click('a[href="http://jaranto.blospot.com"]')
.pause(5000);
browser.expect.element('title').to.be.present;
browser.expect.element('title').text.to.equal("a.p");
browser.end();
}
};
Error is:
Expected element