phonegap webview, test fails when switching to webview

258 views
Skip to first unread message

Adam Teja

unread,
Mar 4, 2014, 8:17:00 AM3/4/14
to appium-...@googlegroups.com
Hello, I have a hybrid Phonegap/cordova app that I'm trying to test on Android at SauceLabs. The app loads and launches in the simulator OK, but I can't seem to locate any elements on the page. The app does seem to take some time to get to the point where the login dialog is shown (due to gratuitous javascript).  I am now trying to switch to "WEBVIEW", to see if I get better results but now I get an Appium error. Any suggestions appreciated - I'm stuck. 

Appium Error:

1152014-03-04T03:06:13.079Z - info: ["webview_devtools_remote_2060"]

1162014-03-04T03:06:13.080Z - info: Connecting to chrome-backed webview

1172014-03-04T03:06:13.080Z - info: Creating Chrome session

1182014-03-04T03:06:13.080Z - info: Ensuring Chromedriver exists

1192014-03-04T03:06:13.081Z - info: Killing any old chromedrivers, running: ps -e | grep /home/chef/appium/build/chromedriver/linux/chromedriver | grep -v grep |grep -e '--port=9515$' | awk '{ print $1 }' | xargs kill -15

1202014-03-04T03:06:13.090Z - info: No old chromedrivers seemed to exist

1212014-03-04T03:06:13.090Z - info: Spawning chromedriver with: /home/chef/appium/build/chromedriver/linux/chromedriver

1222014-03-04T03:06:13.094Z - info: [CHROMEDRIVER STDERR] /home/chef/appium/build/chromedriver/linux/chromedriver: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory

1232014-03-04T03:06:13.095Z - info: Chromedriver exited with code 127

1242014-03-04T03:06:13.096Z - info: Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command. (Original error: Chromedriver quit before it was available)","origValue":"Chromedriver quit before it was available"},"sessionId":"f5d1e1d1-7ad8-4256-b74e-5123471decf3"}



Code:

from selenium import webdriver;
from selenium.webdriver.common.keys import Keys
import time

desired_caps = {
    'device': 'Android',
    'deviceType' : 'phone', #phone, tablet (sauce labs)
    'browserName' :'',
    'version' : '4.3',   #4.2,4.3
#    'app' : '/root/Downloads/DigitalRedBook-debug.apk',
    'app' : 'sauce-storage:DigitalRedBook-debug.zip',
    'app-package' : 'com.redbookconnect.DigitalRedBook',
    'app-activity' : '.DigitalRedBook'
  }


#driver = webdriver.Remote('http://192.168.244.129:4723/wd/hub', desired_caps)
driver = webdriver.Remote('http://USERNAME:API...@ondemand.saucelabs.com:80/wd/hub', desired_caps)

print ( driver.window_handles ) # returns [u'NATIVE_APP', u'WEBVIEW']

time.sleep(15);

driver.switch_to_window(driver.window_handles[1]);   

## THIS IS WHERE IS FAILS ##

element = driver.find_element_by_name("username");
element.send_keys("asmith");

element=driver.find_element_by_name("password");
element.send_keys("testing1")

  
  
driver.quit

Adam Teja

unread,
Mar 6, 2014, 11:02:44 AM3/6/14
to appium-...@googlegroups.com
SOLVED: use Selendroid to automate Hybrid web apps. As far as how to set this up with Appium, that's another story.


desired_caps = {
    'device': 'Selendroid',

Jonathan Lipps

unread,
Mar 6, 2014, 9:02:50 PM3/6/14
to Adam Teja, appium-...@googlegroups.com
Looks like your system isn't configured properly to use chromedriver.

Are you indeed  on linux?

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

naddy095

unread,
May 27, 2014, 7:01:35 AM5/27/14
to appium-...@googlegroups.com, Adam Teja, Jonathan Lipps
Hi Jonathan,

I run the scripts on linux and I am also getting this error.However, running on another Linux machine, it does not have this issue.Kindly help.

Regards.

naddy095

unread,
May 27, 2014, 7:06:13 AM5/27/14
to appium-...@googlegroups.com, Adam Teja, Jonathan Lipps
FYI my logcats

debug: 172.16.41.48 - - "POST /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/elements HTTP/1.1" 200 87 "-" "-"
info: [BOOTSTRAP] [info] Returning result: {"value":[],"status":0}
debug: Appium request initiated at /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/timeouts/implicit_wait
debug: Request received with params: {"ms":60000}
info: Set Android implicit wait to 60000ms
info: Responding to client with success: {"status":0,"value":null,"sessionId":"c663f844-f398-427a-b46a-074aba51c0af"}
debug: 172.16.41.48 - - "POST /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/timeouts/implicit_wait HTTP/1.1" 200 89 "-" "-"
debug: Appium request initiated at /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/execute
debug: Request received with params: {"args":[null],"script":"mobile: currentActivity"}
info: Getting focused package and activity
debug: executing: "/usr/local/adt/adt-bundle-linux-x86_64-20130729/sdk/platform-tools/adb" -s 192.168.56.101:5555 shell "dumpsys window windows"
info: Responding to client with success: {"status":0,"value":".activity.flights.domestic.PaymentInterstitial","sessionId":"c663f844-f398-427a-b46a-074aba51c0af"}
debug: 172.16.41.48 - - "POST /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/execute HTTP/1.1" 200 133 "-" "-"
debug: Appium request initiated at /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/timeouts/implicit_wait
debug: Request received with params: {"ms":60000}
info: Set Android implicit wait to 60000ms
info: Responding to client with success: {"status":0,"value":null,"sessionId":"c663f844-f398-427a-b46a-074aba51c0af"}
debug: 172.16.41.48 - - "POST /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/timeouts/implicit_wait HTTP/1.1" 200 89 "-" "-"
debug: Appium request initiated at /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/window_handles
debug: Request received with params: {}
warn: [DEPRECATED] The getWindowHandles function has been deprecated and will be removed.  Please use the getContexts() function instead.
info: Getting a list of available webviews
debug: executing: "/usr/local/adt/adt-bundle-linux-x86_64-20130729/sdk/platform-tools/adb" -s 192.168.56.101:5555 shell "cat /proc/net/unix"
info: ["webview_devtools_remote_1284"]
info: Responding to client with success: {"status":0,"value":["NATIVE_APP","WEBVIEW"],"sessionId":"c663f844-f398-427a-b46a-074aba51c0af"}
debug: 172.16.41.48 - - "GET /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/window_handles HTTP/1.1" 200 122 "-" "-"
debug: Appium request initiated at /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/window_handle
debug: Request received with params: {}
warn: [DEPRECATED] The getWindowHandle function has been deprecated and will be removed.  Please use the getCurrentContext() function instead.
info: Responding to client with success: {"status":0,"value":"NATIVE_APP","sessionId":"c663f844-f398-427a-b46a-074aba51c0af"}
debug: 172.16.41.48 - - "GET /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/window_handle HTTP/1.1" 200 97 "-" "-"
debug: Appium request initiated at /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/window_handles
debug: Request received with params: {}
info: Getting a list of available webviews
debug: executing: "/usr/local/adt/adt-bundle-linux-x86_64-20130729/sdk/platform-tools/adb" -s 192.168.56.101:5555 shell "cat /proc/net/unix"
info: ["webview_devtools_remote_1284"]
info: Responding to client with success: {"status":0,"value":["NATIVE_APP","WEBVIEW"],"sessionId":"c663f844-f398-427a-b46a-074aba51c0af"}
debug: 172.16.41.48 - - "GET /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/window_handles HTTP/1.1" 200 122 "-" "-"
debug: Appium request initiated at /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/window
debug: Request received with params: {"name":"WEBVIEW"}
warn: [DEPRECATED] The setWindow function has been deprecated and will be removed.  Please use the setContext(name) function instead.
info: Getting a list of available webviews
debug: executing: "/usr/local/adt/adt-bundle-linux-x86_64-20130729/sdk/platform-tools/adb" -s 192.168.56.101:5555 shell "cat /proc/net/unix"
info: ["webview_devtools_remote_1284"]

info: Connecting to chrome-backed webview
info: Creating Chrome session
info: Ensuring Chromedriver exists
info: Killing any old chromedrivers, running: ps -e | grep /var/go/.linuxbrew/lib/node_modules/appium/build/chromedriver/linux/chromedriver | grep -v grep |grep -e '--port=9515$' | awk '{ print $1 }' | xargs kill -15

info: No old chromedrivers seemed to exist
info: Spawning chromedriver with: /var/go/.linuxbrew/lib/node_modules/appium/build/chromedriver/linux/chromedriver
info: [CHROMEDRIVER STDERR] /var/go/.linuxbrew/lib/node_modules/appium/build/chromedriver/linux/chromedriver: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

info: Chromedriver exited with code 127
info: Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command. (Original error: Chromedriver quit before it was available)","origValue":"Chromedriver quit before it was available"},"sessionId":"c663f844-f398-427a-b46a-074aba51c0af"}
debug: 172.16.41.48 - - "POST /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/window HTTP/1.1" 500 298 "-" "-"
debug: Appium request initiated at /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/screenshot
debug: Request received with params: {}
debug: Proxying command to 127.0.0.1:9515
info: Making http request with opts: {"url":"http://127.0.0.1:9515/wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/screenshot","method":"GET"}
info: Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command.","origValue":"Did not successfully proxy server command"},"sessionId":"c663f844-f398-427a-b46a-074aba51c0af"}
debug: 172.16.41.48 - - "GET /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af/screenshot HTTP/1.1" 500 238 "-" "-"
debug: Appium request initiated at /wd/hub/session/c663f844-f398-427a-b46a-074aba51c0af
debug: Request received with params: {}
info: Shutting down appium session...
info: Removing app from device
info: Uninstalling com.android
debug: executing: "/usr/local/adt/adt-bundle-linux-x86_64-20130729/sdk/platform-tools/adb" -s 192.168.56.101:5555 shell "am force-stop com.android"
debug: executing: "/usr/local/adt/adt-bundle-linux-x86_64-20130729/sdk/platform-tools/adb" -s 192.168.56.101:5555 uninstall com.android
debug: App was uninstalled
info: [ADB] Pressing the HOME button
debug: executing: "/usr/local/adt/adt-bundle-linux-x86_64-20130729/sdk/platform-tools/adb" -s 192.168.56.101:5555 shell "input keyevent 3"
info: Stopping logcat capture
debug: Logcat terminated with code null, signal SIGTERM
info: Cleaning up Chromedriver
info: Killing chromedriver
info: Didn't get a new command in 120 secs, shutting down...
info: Shutting down appium session...
info: Removing app from device
info: Uninstalling com..android
debug: executing: "/usr/local/adt/adt-bundle-linux-x86_64-20130729/sdk/platform-tools/adb" -s 192.168.56.101:5555 shell "am force-stop com..android"
debug: executing: "/usr/local/adt/adt-bundle-linux-x86_64-20130729/sdk/platform-tools/adb" -s 192.168.56.101:5555 uninstall com.
.android
debug: App was not uninstalled, maybe it wasn't on device?
info: [ADB] Pressing the HOME button
debug: executing: "/usr/local/adt/adt-bundle-linux-x86_64-20130729/sdk/platform-tools/adb" -s 192.168.56.101:5555 shell "input keyevent 3"
info: Cleaning up Chromedriver
info: Killing chromedriver

mohammad nadeem

unread,
May 27, 2014, 9:00:17 AM5/27/14
to appium-...@googlegroups.com
Ok, solved the issue.

"sudo ln -s /usr/lib/x86_64-linux/libnss3.so /usr/lib/libnss3.so"
Made a link for libnss3.so at /usr/lib/libnss3.so and restart the system. Works fine.

Thanks and regards.


--
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.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages