question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Page source command returns invalid output when < character appears on page

See original GitHub issue

The 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 &lt; 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:

  1. Open iOS simulator
  2. Open Messages application
  3. In the text field, type Test <>"'&
  4. Start session with the device using Appium client python library
  5. 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 <>&quot;'&amp;"

You can check out full page source here.

Here is my sample script: test_page_source.py

Screenshot of application state: Screenshot 2021-11-03 at 14 14 22

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:closed
  • Created 2 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
a-bastrykinacommented, Nov 5, 2021

Thanks. I checked with appium@beta and confirm that the issue is fixed.

0reactions
mykola-mokhnachcommented, Nov 5, 2021

the only way to get it is via NPM: npm i -g appium@beta

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid character in identifier - python - Stack Overflow
I keep getting an error message that says "invalid character in identifier". What does this mean and how can it be fixed? Here...
Read more >
What went wrong? Troubleshooting JavaScript - MDN Web Docs
Go to the tab that you've got number-game-errors.html open in, and open your JavaScript console. You should see an error message along the ......
Read more >
Bash Reference Manual - GNU.org
This chapter briefly summarizes the shell's 'building blocks': commands, control structures, shell functions, shell parameters, shell expansions ...
Read more >
Razor syntax reference for ASP.NET Core - Microsoft Learn
The @page directive has different effects depending on the type of the file where it appears. The directive: In a .cshtml file indicates...
Read more >
Special Commands - Doxygen Manual
The file manual.c in the example directory shows how to use this command. Click here for the corresponding HTML documentation that is generated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found