Page source command returns invalid output when < character appears on page
See original GitHub issueThe problem
I’m trying to parse driver.page_source
command output and expect it to be a valid XML in native applications contexts. This worked in the older versions of Appium server, but starting from 1.21 when a <
symbol appear on page, the command responds with invalid XML output - a <
symbol does not get escaped with <
as it should.
Environment
- Appium version (or git revision) that exhibits the issue: 1.21
- Last Appium version that did not exhibit the issue (if applicable): 1.20
- Desktop OS/version used to run Appium: 1.21
- Node.js version (unless using Appium.app|exe): -
- Npm or Yarn package manager: npm
- Mobile platform/version under test: iOS 14.4, XCUITest driver
- Real device or emulator/simulator: iPhone 12 simulator
- Appium CLI or Appium.app|exe: Appium.app
Details
My steps to reproduce are:
- Open iOS simulator
- Open Messages application
- In the text field, type
Test <>"'&
- Start session with the device using Appium client python library
- Query
driver.page_source()
command and try to parse its output with XML parser
Actual result: Page source contains forbidden <
symbol inside element attribute so it cannot be parsed. Please note that &
and "
get escaped as expected:
value="Test <>"'&"
You can check out full page source here.
Here is my sample script: test_page_source.py
Screenshot of application state:
Link to Appium logs
https://gist.github.com/a-bastrykina/4d0e7eac28bc2e4814a0134082036e23
Code To Reproduce Issue [ Good To Have ]
Please remember that with sample code it’s easier to reproduce the bug and it’s much faster to fix it.
Please git clone https://github.com/appium/appium and from the sample-code
directory, use one of your favourite languages and sample apps to reproduce the issue.
In case a similar scenario is missing in sample-code, please submit a PR with one of the sample apps provided.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (2 by maintainers)
Top GitHub Comments
Thanks. I checked with appium@beta and confirm that the issue is fixed.
the only way to get it is via NPM:
npm i -g appium@beta