iOS: getPageSource() not showing any elements

832 views
Skip to first unread message

Al Villaflor

unread,
Jun 10, 2013, 10:19:28 AM6/10/13
to appium-...@googlegroups.com
Wonder if anyone is also seeing this? OR could help me debug what is going on.  this is an app on the iphone simulator and I started seeing it on v0.7.0

At first, I thought it was some timing issue so I added some delays on my scripts. 
When getting the page source, it seems to think that nothing is loaded. But I can actually see the app launched. 

This occurs randomly, so I can't pinpoint where or why it thinks the app is not loaded.  I can see that it fixes itself, by quitting and restarting the driver.


>>> d.getPageSource()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
Command duration or timeout: 166 milliseconds
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:22:56'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.4', java.version: '1.6.0_45'
Session ID: 9c729b02-23d1-46d7-bac0-572069a4a608
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{platform=MAC, databaseEnabled=false, javascriptEnabled=true, browserName=iOS, webStorageEnabled=false, locationContextEnabled=false, takesScreenshot=true, version=6.0}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:569)
at org.openqa.selenium.remote.RemoteWebDriver.getPageSource(RemoteWebDriver.java:414)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)

org.openqa.selenium.WebDriverException: org.openqa.selenium.WebDriverException: An error occurred while executing user supplied JavaScript. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 166 milliseconds
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:22:56'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.4', java.version: '1.6.0_45'
Session ID: 9c729b02-23d1-46d7-bac0-572069a4a608
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{platform=MAC, databaseEnabled=false, javascriptEnabled=true, browserName=iOS, webStorageEnabled=false, locationContextEnabled=false, takesScreenshot=true, version=6.0}]


debug: Appium request initiated at /wd/hub/session/9c729b02-23d1-46d7-bac0-572069a4a608/source
info: Pushing command to appium work queue: "wd_frame.getPageSource()"
debug: Sending command to instruments: wd_frame.getPageSource()
info: [INSTSERVER] Sending command to instruments: wd_frame.getPageSource()
info: [INST] 2013-06-10 14:07:22 +0000 Default: Got new command 4 from instruments: wd_frame.getPageSource()
info: [INSTSERVER] Socket data received (131 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":17,"value":"'[object UIAElementNil]' is not a function (evaluating 'wd_frame.getPageSource()')"}
info: Responding to client with error: {"status":17,"value":{"message":"An error occurred while executing user supplied JavaScript.","origValue":"'[object UIAElementNil]' is not a function (evaluating 'wd_frame.getPageSource()')"},"sessionId":"9c729b02-23d1-46d7-bac0-572069a4a608"}
GET /wd/hub/session/9c729b02-23d1-46d7-bac0-572069a4a608/source 500 161ms - 271

bootstrap online

unread,
Jun 10, 2013, 9:10:28 PM6/10/13
to Al Villaflor, appium-...@googlegroups.com
I think it's best to track bugs on GitHub. Is your app available to
reproduce the issue? Does it reproduce on the demo app
(https://github.com/appium/appium/blob/master/assets/UICatalog6.1.app.zip)?
> --
> http://appium.io
> ---
> You received this message because you are subscribed to the Google Groups
> "Appium-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to appium-discus...@googlegroups.com.
> Visit this group at http://groups.google.com/group/appium-discuss?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Tomek

unread,
Jun 12, 2013, 4:54:53 AM6/12/13
to appium-...@googlegroups.com, Al Villaflor
Hello,


I will also wirte here one my problems, which is still from 2 months.

Sometimes when i our automaiton tests are running getPageSoruce method don't get page soruce of page.


sometimes, and i don't know exactly why, when i want in some moment of test to get the page soruce to valdiate soemthing i get something like that:

{"name":null,"type":"UIAWindow","label":null,"value":null,"rect":{"origin":{"x":1024,"y":-1.9984712600708008},"size":{"width":0,"height":1.9984712600708008}},"dom":null,"enabled":false,"valid":false,"visible":false,"children":[]}



it always looks the same, the same values etc. It is randomly, so hard to reproduce, maybe someone sometimes has this problem, and know why it appears.

Jonathan Lipps

unread,
Jun 12, 2013, 9:13:53 AM6/12/13
to Tomek, appium-...@googlegroups.com, Al Villaflor
I believe this is because there is a tiny window in front of the "real" window which is being considered mainWindow() by UIAutomation.

2 solutions:
1) ask your app developer why there would be a tiny window in front, see if maybe you can remove it
2) appium can (and should--see my previous e-mails on this subject) include all available windows in page source, or at least hint that there are other windows.

Tomek

unread,
Jun 12, 2013, 10:52:55 AM6/12/13
to appium-...@googlegroups.com, Tomek, Al Villaflor
Hello,

So the problem is that there is no main Window. Of course i remember that Appium pageSource use to get pageSource with all windows, but form some time i used to get something like that:

{"name":null,"type":"UIAWindow","label":null,"value":null,"rect":{"origin":{"x":1024,"y":-1.9984712600708008},"size":{"width":0,"height":1.9984712600708008}},"dom":null,"enabled":false,"valid":false,"visible":false,"children":[]}
0
Is element: <¥TEST¥> displayed?
{"name":null,"type":"UIAWindow","label":null,"value":null,"rect":{"origin":{"x":1024,"y":7.364969131651346e-38},"size":{"width":0,"height":0}},"dom":null,"enabled":false,"valid":false,"visible":false,"children":[]}



those are new one.


I don't know how to handle it, is there some possible to chang einwdow to main window or soemthing like that? or some other solutions?

Tomek

unread,
Jun 12, 2013, 11:07:29 AM6/12/13
to appium-...@googlegroups.com, Tomek, Al Villaflor
OK, so if i run inspector, the first on the list appears UIPopover, so maybe it is the cause of this.

But what i remmeber when i was writing this test 3 months ago, when i get pageSource, i had all elements in this pageSource, including this elements on popover. So why it is chnaged now, or how to make sure that i will get always the proper page Source? some refresh method of app ro soemthing like that?





W dniu środa, 12 czerwca 2013 15:13:53 UTC+2 użytkownik Jonathan Lipps napisał:

Jonathan Lipps

unread,
Jun 14, 2013, 1:25:41 PM6/14/13
to Wolas Tomasz, appium-...@googlegroups.com
We need to publish for an npm update to get the changes. I'm going to try and get a release out today.

On Jun 13, 2013, at 5:17 PM, Wolas Tomasz <two...@gmail.com> wrote:

Thank You very much !

I would like to check it. I have a simple question, because on my jenkins machine i have Apppium installed using :
npm install -g appium,


so i see that you have merged this fix to main code, but i have a question, that do i need to wait for some release to ahve it, or if i just now type:
npm update -g appium (i get this command form some other post, and idn't check ti yet) , it will update to the newest HEAD from code. Or do i need to check for you soem release to have it ?

I would be apprecaite if you will anwser me :)





2013/6/13 Jonathan Lipps <jli...@gmail.com>
This was recently fixed in https://github.com/appium/appium/pull/748

get page source should now return all windows and elements

On Jun 12, 2013, at 4:04 PM, twolas <two...@gmail.com> wrote:

Hi Jonathan.  You mention about some your emails about this subject but i can't find any of them. Could you tell me if you know of course, how to make sure that when i get page source using driver.get...source method i will vet the page source for all windows/elemnets. Sometimes i have for all elements but sometimes only this which i mentioned in this topic.


Wysłane z telefonu Samsung



-------- Oryginalna wiadomość --------
Od: Jonathan Lipps <jli...@gmail.com>
Data: 12.06.2013 15:13 (GMT+01:00)
Do: Tomek <two...@gmail.com>
DW: appium-...@googlegroups.com,Al Villaflor <alvil...@gmail.com>
Temat: Re: [appium-discuss] iOS: getPageSource() not showing any elements

Wolas Tomasz

unread,
Jun 24, 2013, 4:25:04 AM6/24/13
to Jonathan Lipps, appium-...@googlegroups.com
Hello Jonathan,


have you released this feature to appium on npm ? I mean this one with getting pagfeSoruce, and elements for all views ?


Tomek


2013/6/14 Jonathan Lipps <jli...@gmail.com>

Jonathan Lipps

unread,
Jun 25, 2013, 11:22:53 AM6/25/13
to Wolas Tomasz, appium-...@googlegroups.com
Yes, that was 0.7.2 I believe.
Reply all
Reply to author
Forward
0 new messages