user3227132
user3227132

Reputation: 21

Unable to access WebView elements

I tried to access webView elements using Calabash-iOS using following query:

query("webView css:'*'")

But it is unable to detect the elements. When I touch any input field manually, it gets zoomed in and I am able to view the elements using the above query.

Can I get any solution for this?

Upvotes: 0

Views: 550

Answers (2)

Sebastian A.
Sebastian A.

Reputation: 11

1) First of all, make sure that you know the correct type of webview present in the app. Easiest way of specifying the webview element is by using the element class or the element's id.

To get the correct element class, you can run the following command in the console:
irb> classes '*'

This should return an array of elements, something like:
[0] UIView
[1] UIImageView
[2] UICollectionView
[3] UICollectionViewCell
....
[x] UIWebView
...

To show the id's for all elements, use the command:
irb> identifier '*'

2) Once you identified the correct webview container element, than you can use it in your query:
irb> query "UIWebView css:''"
Alternatively, you can identify the webview container using it's id:
irb> query "
id:'web_view' css:'*'"

If you need more information on how to identify elements inside webviews, check the link below:

https://github.com/calabash/calabash-ios/wiki/06-WebView-Support

Upvotes: 1

Chathura Palihakkara
Chathura Palihakkara

Reputation: 934

Try query("all webView css:'*'")

Upvotes: 0

Related Questions