MarketSquare / MarketSquare/robotframework-browser
Webkit returns additional new line character with element.innerText
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 655
- Forks
- 147
- Avg merge
- 5h 27m
- Merged PRs (30d)
- 59
Description
**Describe the bug**
When using Get Text keyword using Webkit there's an additional new line character in the returned text. This has been reported to Playwright (https://github.com/microsoft/playwright/issues/7698 and https://github.com/microsoft/playwright/issues/5478) where suggestion is to use element.textContent instead.
If I'm not mistaken Get Text keyword returns element.innerText (https://github.com/MarketSquare/robotframework-browser/blob/6a5116dd5a45b74938997618c67ac0fe94b49e49/node/playwright-wrapper/getters.ts#L104). I know this is a Webkit specific issue but I'd be interested to know what is the reason for use of innerText? Element.textContent would fix this (for us) but there's probably a good reason to use innerText?
**To Reproduce**
Steps to reproduce the behavior:
1. Set HTML content foo
2. ${text} = Get Text id=important
3. On Chromium and Firefox ${text} == "foo"
4. On Webkit ${text} == "foo\n"
**Expected behavior**
I would expect the text content to be the same on Chromium, Firefox and Webkit.
**Screenshots**
-
**Desktop (please complete the following information):**
- OS: macOs 15.1.1 (24B91)
- Browser webkit
- Version v19.1.0
**Smartphone (please complete the following information):**
-
**Additional context**
-
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at node/playwright-wrapper/getters.ts around the linked Get Text implementation; reproduce the button and span case on Chromium, Firefox, and WebKit and inspect the existing getter tests. Done means the selected behavior is covered by a regression test and Get Text returns the agreed, consistent value across these browsers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- playwright, typescript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 67/100