If the character string of an element that is tested on iOS contains a line break, the line break character may be confused with a single-byte space character due to limitations of Appium, which is the framework on which MagicPod is based. In principle, MagicPod will treat the line breaks as line breaks and spaces as spaces. However, there are some exceptions.
When using "xpath" or "-ios class chain" to specify elements
In some cases where the string contains a line break, it is possible to search for elements and check values even if spaces are used.
Line breaks within elements |
Searching for locators containing line breaks |
Use strings containing line breaks both for searching and checking values |
Searching with locators containing spaces |
Use strings containing spaces both for searching and checking values |
Storing elements values as variables |
---|---|---|---|---|---|
Yes |
Success |
Success |
*1 |
*1 |
Store as “Magic\nPod” |
No |
Fail |
Fail |
Success |
Success |
Store as “Magic Pod” |
Behavior when searching a UI element that contains line breaks with locators containing spaces
For cases marked as "*1" in the table, the behavior can differ according to your environment (It will be described later). It is related to changes that don't maintain backward compatibility, which have been added to Appium several times. As locators containing line breaks didn't work before (around 2020), we once recommended that customers manually add a locator using spaces. After that, we have a period when both line breaks and spaces worked. However, after a certain change in 2025, locators containing spaces failed to locate elements.
If locators containing spaces that were manually added are used, the locators will be auto-healed to those containing line breaks when used in a batch run. If no problem, please accept the healing result and keep using the locator containing line breaks. If you have test steps where the UI element's text is asserted, you need to modify the expected value to use line breaks.
Difference among environments
The table below shows difference among environments when searching a UI element containing line breaks with a locator containing spaces. Although the difference due to MagicPodDesktop versions is not changed in principle, the behavior when using external cloud services can change by MagicPod releases. When you have any concerns, please check the latest information on this page.
Environment | When using a locator containing spaces |
---|---|
Local PC (MagicPodDesktop 1.37.0 or earlier) | Success |
Local PC (MagicPodDesktop 1.38.0 or later) | Fail or auto-healed |
External cloud service (BrowserStack) | Fail or auto-healed |
External cloud service (SauceLabs) |
Success |
External cloud service (Remote TestKit) |
Undetermined only on iOS 18. Success on other OS versions. |