Why would my hybrid app not show WEBVIEW context

2,117 views
Skip to first unread message

Satyajit Malugu

unread,
Jun 4, 2014, 8:31:58 PM6/4/14
to appium-...@googlegroups.com
We clearly have a hybrid app (some screens are native, some come from webview). I put a break point in  a webview and ask for available_contexts and I see only NATIVE_APP.
Is there something that I need to add to driver initialization?

bootstrap online

unread,
Jun 4, 2014, 8:46:31 PM6/4/14
to Satyajit Malugu, appium-...@googlegroups.com
Make sure setWebContentsDebuggingEnabled is true.
http://developer.android.com/reference/android/webkit/WebView.html#setWebContentsDebuggingEnabled(boolean)
> --
> 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.

Satyajit Malugu

unread,
Jun 4, 2014, 9:10:53 PM6/4/14
to appium-...@googlegroups.com, sa...@malugu.com

Cool, that doesn't seem to be set in our Android app. For our ios app, I am seeing both and even though I set the context="WEBVIEW_1".
Also what additional things can I do by switching to WEBVIEW? can I search by html id's?

bootstrap online

unread,
Jun 4, 2014, 9:53:55 PM6/4/14
to Satyajit Malugu, appium-...@googlegroups.com
Update to new appium_lib. context= is broken. The new method is set_context.
https://github.com/appium/ruby_lib/blob/master/docs/migration.md

bootstrap online

unread,
Jun 4, 2014, 9:54:31 PM6/4/14
to Satyajit Malugu, appium-...@googlegroups.com

On Wed, Jun 4, 2014 at 5:10 PM, Satyajit Malugu <sa...@malugu.com> wrote:

Also what additional things can I do by switching to WEBVIEW? can I search by html id's?

Switching to webview means you are using normal selenium webdriver commands. Yes, you can search by html ids.

Satyajit Malugu

unread,
Jun 4, 2014, 11:40:11 PM6/4/14
to appium-...@googlegroups.com, sa...@malugu.com
Oh freaking awesome! This works!

Jonathan Lipps

unread,
Jun 5, 2014, 12:14:01 AM6/5/14
to Satyajit Malugu, appium-...@googlegroups.com
yeah, it's kind of fun. two drivers in one!

xlzde...@gmail.com

unread,
Jun 6, 2014, 2:16:47 AM6/6/14
to appium-...@googlegroups.com, sa...@malugu.com
sorry to interrupt. I tried to test the hybrid app by using appium either , but got some issues. Could you share me the capabilities configuration of in your test cases which can make two drivers working together?

Thanks in advances.

Satyajit Malugu

unread,
Jun 6, 2014, 4:56:43 PM6/6/14
to appium-...@googlegroups.com, sa...@malugu.com
You could retain your existing capabilities. Depending on your client language/driver you need to switch to webview context. eg in ruby:
def switch_to_webview
  wait_true { available_contexts.include? 'WEBVIEW_1' }
  set_context 'WEBVIEW_1' unless current_context.equal? 'WEBVIEW_1'
end

xlzde...@gmail.com

unread,
Jun 9, 2014, 2:31:10 PM6/9/14
to appium-...@googlegroups.com, sa...@malugu.com
Thanks for replying . I tried to describe my issue in the following topic for webview testing :
https://groups.google.com/forum/#!topic/appium-discuss/-Horgi1P8zw

could you take a look and help with that?

Thanks very much.

bootstrap online

unread,
Aug 2, 2014, 8:35:19 PM8/2/14
to appium-...@googlegroups.com
uiautomatorviewer isn't designed for web views. You should be able to
find the elements via id once you're in the web context.

On Sat, Aug 2, 2014 at 4:29 PM, <ramshanka...@gmail.com> wrote:
> Hey,
>
> I need your help. Please look into this.
>
> We have a phonegap android application with all the html id's and all.
>
> But the problem is when I inspect the element in android uiautomatorviewer
> it does not list under android resource id. Is there any configuration in
> phonegap or anywhere , so that the same id will appear in android
> uiautomatorviewer as well.
>
>
> Thanks,
Message has been deleted

Ryan Bedino

unread,
Aug 14, 2014, 5:55:08 PM8/14/14
to appium-...@googlegroups.com
What if I do not have id's to go by? It's a Sencha/Cordova application and static id's are a no-no. I have a content-desc ("name" field), however in the WEB_VIEW context chromedriver is not finding the element by name.

Any suggestions?

Thanks!

bootstrap online

unread,
Aug 14, 2014, 5:58:36 PM8/14/14
to Ryan Bedino, appium-...@googlegroups.com
If it's a web view then use standard selenium locators such as css selectors.

Ryan Bedino

unread,
Aug 14, 2014, 6:03:55 PM8/14/14
to appium-...@googlegroups.com, arcanu...@gmail.com
And how would one go about determining the css value for this:

bootstrap online

unread,
Aug 14, 2014, 6:08:41 PM8/14/14
to Ryan Bedino, appium-...@googlegroups.com
you need to dump the html source from the web context. It's not available from the native context. uiautomatorviewer only displays the native context.

Ryan Bedino

unread,
Aug 15, 2014, 7:27:18 PM8/15/14
to appium-...@googlegroups.com, arcanu...@gmail.com
And of course from a Sencha application, location and reuse of elements is going to be completely untenable. Great.

bootstrap online

unread,
Aug 15, 2014, 7:48:49 PM8/15/14
to Ryan Bedino, appium-...@googlegroups.com
Sencha must have some way of uniquely identifying elements?

Ryan Bedino

unread,
Aug 18, 2014, 12:31:47 PM8/18/14
to appium-...@googlegroups.com, arcanu...@gmail.com
Not really. The elements are generated dynamically (Cordova wrapped), which means that by xpath, css, or id, everything will always change. I think I may need to get the dev team to add some kind if itemId and/or a name.

bootstrap online

unread,
Aug 18, 2014, 12:37:59 PM8/18/14
to Ryan Bedino, appium-...@googlegroups.com
Yes, the devs should add unique ids.

Ryan Bedino

unread,
Aug 18, 2014, 8:17:03 PM8/18/14
to appium-...@googlegroups.com
Just discovered that for this, itemID and name are not able to be found by automation. We are going to try a unique cls identifier.

Ryan Bedino

unread,
Aug 19, 2014, 4:57:53 PM8/19/14
to appium-...@googlegroups.com
So, I was able to locate the element. But I can't interact with in no matter what I've tried. This is just depressing.
Reply all
Reply to author
Forward
0 new messages