webdriverio: [๐ Bug]: getText() is returning the text value along with preceding spaces
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
latest
Node.js Version
latest
Mode
WDIO Testrunner
Which capabilities are you using?
{
maxInstances: 15,
browserName: 'safari',
browserVersion: 'latest',
os: 'OS X',
osVersion: 'Big Sur',
acceptInsecureCerts: true
}
What happened?
$(locator).getText() is giving the text content with preceding spaces.
this happens only with safari. Chrome and edge works fine with the same code.
What is your expected behavior?
getText() to return the text content without adding any additional spaces
How to reproduce the bug.
use $(locator).getText() in safari BigSur
Relevant log output
NA
Code of Conduct
- I agree to follow this projectโs Code of Conduct
Is there an existing issue for this?
- I have searched the existing issues
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (8 by maintainers)
@rameshkumarj can you provide an simple example which allows us to reproduce this? It can be on any random website. I believe in general the returned text should be not trimmed. WebdriverIO doesnโt do any operations on it. The WebDriver protocol defines the
get element textas basically doing this:and
innerTextis defined to return โthe elementโs text content "as renderedโ which I guess can be ambiguous.