Search code examples
javascriptselenium-webdriverwebdriverwebdriver-io

WebDriverIO transforms the text read using getText() API


I have an element with text:

<span class="mat-button-wrapper">Sicherheitsfrage ändern</span>

When I want to check text, webdriver says that is wrong

assert.strictEqual($(.mat-button-wrapper).getText(), 'Sicherheitsfrage ändern')

In console.log this text is next Sicherheitsfrage einrichten but must be Sicherheitsfrage ändern

Why it transforms the text? Can I avoid it?


Solution

  • Selector was good. The problem was in the account. Testing was going on another account and for this account text was anouther.