WebDriver 5: seeTextEquals passes for any string if element is empty
See original GitHub issueIt works as expected with WebDriver 4 and doesn’t work with WebDriver 5.
What are you trying to achieve?
I want to test if the exact text “Authentication failed.” appears in the p
subelement of
<div class="ui error message">
<div class="content">
<p></p>
</div>
</div>
Let’s say now there is no value in p
.
So I.seeTextEquals("Authentication failed.", ".error.message");
should fail.
What do you get instead?
Provide console output if related. Use
--verbose
mode for more details.
This test passes:
Emitted | step.start (I see text equals "Authentication failed.", ".error.message")
I see text equals "Authentication failed.", ".error.message"
› [SmartWait (20000ms)] Locating .error.message in 20000
Emitted | step.passed (I see text equals "Authentication failed.", ".error.message")
Emitted | step.finish (I see text equals "Authentication failed.", ".error.message")
Provide test source code if related
I.seeTextEquals("Authentication failed.", ".error.message");
Details
- CodeceptJS version: 2.0.7
- NodeJS Version: 10.15.1
- Operating System: Ubuntu 18.10
- WebDriver: 5.7.2
- Configuration file:
exports.config = {
tests: "./*_test.js",
output: "./output",
helpers: {
WebDriver: {
url: "http://localhost",
browser: process.profile || "chrome",
waitForTimeout: 20000,
smartWait: 20000
}
},
include: {
I: "./steps_file.js"
},
bootstrap: null,
mocha: {},
name: "demo"
};
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
WebDriver 5: seeTextEquals passes for any string if element is ...
I want to test if the exact text "Authentication failed. ... WebDriver 5: seeTextEquals passes for any string if element is empty #1561....
Read more >I want to pass my test if the element in selenium returns empty ...
logger.info("The text is "+ element.getText()); Assert. ... You can use Assertions to fail the case if string is not empty.
Read more >WebDriver - CodeceptJS
Attaches a file to element located by label, name, CSS or XPath Path to file is relative current codecept directory (where codecept.conf.ts or ......
Read more >WebElement..getText() sometimes returns empty string when ...
I am finding that WebElement.getText() returns an empty string sometimes, but when it happens and I take a screenshot, the text is there....
Read more >Waits - Selenium
An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to find an element...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Found the issue and fixed it -> https://github.com/Codeception/CodeceptJS/pull/1564
It works well with CodeceptJS 2.3.6, WebDriverIO 5.16.13