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.

getPageSource is empty on iOS

See original GitHub issue

The problem

Hello,

I have a problem when I want to get page source on Appium with a Real iOS devices ().

It return only the root element (with the bad tagname XCUIElementTypeOther insteadof XCUIElementTypeApplication)

Environment

  • Appium version (or git revision) that exhibits the issue: 1.10.0
  • Last Appium version that did not exhibit the issue (if applicable): /
  • Desktop OS/version used to run Appium: Mac OS Mojave
  • Node.js version (unless using Appium.app|exe): v8.12.0
  • Mobile platform/version under test: iOS 11.2.6
  • Real device or emulator/simulator: Real Device
  • Appium CLI or Appium.app|exe: with appium java-client:7.0.0

Details

When I call getPageSource(), I receive that :

<?xml version="1.0" encoding="UTF-8"?>
<AppiumAUT>
 <XCUIElementTypeOther type="XCUIElementTypeOther" name="Auchan" label="Auchan" enabled="true" visible="true" x="0" y="0" width="375" height="667" />
</AppiumAUT>

who corresponding to this screen (I have the problem only on this screen): image

Perhaps it is an element who is not managing by appium ? It is the first screen I test with a list on iOS

On other screen of my application, I usually receive that :

<?xml version="1.0" encoding="UTF-8"?>
<AppiumAUT>
 <XCUIElementTypeApplication type="XCUIElementTypeApplication" name=" " label=" " enabled="true" visible="true" x="0" y="0" width="375" height="667">
   <XCUIElementTypeWindow type="XCUIElementTypeWindow" enabled="true" visible="false" x="0" y="0" width="375" height="667">
     <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="375" height="667">
       <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="375" height="667" />
     </XCUIElementTypeOther>
   </XCUIElementTypeWindow>
   <XCUIElementTypeWindow type="XCUIElementTypeWindow" enabled="true" visible="false" x="0" y="0" width="375" height="667">
     <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="375" height="667">
       <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="375" height="667">
         <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="375" height="667" />
       </XCUIElementTypeOther>
     </XCUIElementTypeOther>
     <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="375" height="667" />
   </XCUIElementTypeWindow>
   <XCUIElementTypeWindow type="XCUIElementTypeWindow" enabled="true" visible="false" x="0" y="0" width="375" height="667">
     <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="0" height="0">
       .......
     </XCUIElementTypeOther>
   </XCUIElementTypeWindow>
   <XCUIElementTypeWindow type="XCUIElementTypeWindow" enabled="true" visible="false" x="0" y="0" width="375" height="667">
     <XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="375" height="667" />
   </XCUIElementTypeWindow>
 </XCUIElementTypeApplication>
</AppiumAUT>

Link to Appium logs

Appium log : https://gist.github.com/nicodeur/89a3bb62ca3c0f9ab270eb98b7541703

Code To Reproduce Issue [ Good To Have ]

I execute it from Cerberus

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
nicodeurcommented, Jan 9, 2019

After more investigation, I tested on an other device (iOs 12.0.1).

getPageSource works ! But I have a big list who was load (103 elemt). Appium click can click on an element, but it is very slow (between 150 to 300 seconds for a simple click !)

After I filtered elements of my list (1 result), I can click quickly.

Any idea ?

0reactions
uteratorcommented, Jul 23, 2019

Server logs on this issue

[HTTP] {}
[MJSONWP (3d194592)] Calling AppiumDriver.getSession() with args: ["3d194592-8ce3-4b56-80f5-a3dc9e1315bf"]
[XCUITest] Executing command 'getSession'
[WD Proxy] Got response with status 200: {"value":"*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: top)\n\n(\n\t0   CoreFoundation                      0x0000000182a48edc  + 252\n\t1   libobjc.A.dylib                     0x0000000181c19a40 objc_exception_throw + 56\n\t2   CoreFoundation                      0x00000001829c0494 _CFArgv + 0\n\t3   CoreFoundation                      0x0000000182933a30  + 932\n\t4   WebDriverAgentLib                   0x0000000102ad1f64 +[FBXPath writeXmlWithRootElement:indexPath:elementStore:includedAttributes:writer:] + 2472\n\t5   WebDriverAgentLib                   0x0000000102ad0d50 +[FBXPath xmlRepresentationWithRootElement:writer:elementStore:query:] + 436\n\t6   WebDriverAgentLib                   0x0000000102ad0370 +[FBXPath matchesWithRootElement:forQuery:] + 284\n\t7   WebDriverAgentLib                   0x0000000102ae8ca8 -[XCUIElement(FBFind) fb_descendantsMatchingXPathQuery:shouldReturnAfterFirstMatch:] + 216\n\t8   WebDriverAgentLib                   0x000000010...
[WD Proxy] Got an unexpected response: {"value":"*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: top)\n\n(\n\t0   CoreFoundation                      0x0000000182a48edc  + 252\n\t1   libobjc.A.dylib                     0x0000000181c19a40 objc_exception_throw + 56\n\t2   CoreFoundation                    ...
[MJSONWP] Matched JSONWP error code 13 to UnknownError
[XCUITest] Merging WDA caps over Appium caps for session detail response
[MJSONWP (3d194592)] Responding to client with driver.findElements() result: []
[HTTP] <-- POST /wd/hub/session/3d194592-8ce3-4b56-80f5-a3dc9e1315bf/elements 200 35872 ms - 74
[HTTP] 
[XCUITest] Merging WDA caps over Appium caps for session detail response
Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS: getPageSource() not showing any elements
This occurs randomly, so I can't pinpoint where or why it thinks the app is not loaded. I can see that it fixes...
Read more >
I'm trying to get page source code using Selenium, but I got ...
it worked out for Baidu.com and example.com. but when it comes to the URL i actually need,I got empty page.and the source code...
Read more >
Appium iOS Testing - 'getPageSource' and 'Requesting ...
My tests get stuck when trying to access UI-Elements at a certain point in my app. 'getPageSource' and 'Requesting snapshot of accessibility ...
Read more >
3 Ways to View Page Source on iPhone or iPad
Learn 3 methods to view page source on iPhone or iPad. No need to download additional apps. Works for Safari and Chrome.
Read more >
How to get page source/App hirarachy in Appium?
... ios device using appium? How to remove all network connection in appium? Home >> Appium Tricks and Tricks >> How to get...
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