In this video, we are going to see how we can switch from Native context to Webview context to automate hybrid app in Appium
One of the core principles of Appium is that you shouldn't have to change your app to test it. In line with that methodology, it is possible to test hybrid apps the same way you can with Selenium for web apps. There is a bit of technical complexity required so that Appium knows whether you want to automate the native aspects of the app or the web views. But, thankfully, we can stay within the Selenium WebDriver protocol for everything.
Once the test is in a web view context the command set that is available is the full Selenium WebDriver API.
Entering the web view context
Here are the steps required to talk to a web view in your Appium test:
1. Navigate to a portion of your app where a web view is active
2. Retrieve the currently available contexts
* This returns a list of contexts we can access, like 'NATIVE_APP' or 'WEBVIEW_1'
3. Set the context with the id of the context you want to access
* This puts your Appium session into a mode where all commands are interpreted as being intended for automating the web view, rather than the native portion of the app. For example, if you run getElementByTagName, it will operate on the DOM of the web view, rather than return native elements. Of course, certain WebDriver methods only make sense in one context or another, so in the wrong context you will receive an error message.
4. To stop automating in the web view context and go back to automating the native portion of the app, simply set the context again with the native context id (generally 'NATIVE_APP') to leave the web context and once again access the native commands.
Automatically entering the web view context on session start
If your application begins in a web view, and you do not want to automate the native application before entering it, you can have Appium automatically enter the web view context on session initialization by setting the autoWebview desired capability to true.
Other Playlist:
TestNg : [ Ссылка ]
Appium: [ Ссылка ]
C# For Beginners Playlist: [ Ссылка ]
Full Software Testing Course: [ Ссылка ]
Python + Selenium Basic: [ Ссылка ]
GraphQL Automation: [ Ссылка ]
Mobile Testing: [ Ссылка ]
Interview Questions: [ Ссылка ]
Subscribe to my YouTube channel: [ Ссылка ]
► Support or Follow me:
- [ Ссылка ]
- Twitter: [ Ссылка ]
- Follow me on LinkedIn: www.linkedin.com/comm/mynetwork/discovery-see-all?usecase=PEOPLE_FOLLOWS&followMember=saifsms91
- Website: [ Ссылка ]
- GitHub: [ Ссылка ]
- Buy me a coffee: [ Ссылка ]
- Facebook page: [ Ссылка ]
- Facebook group: [ Ссылка ]
Group : [ Ссылка ]
Channel: [ Ссылка ]
Instagram: [ Ссылка ]
⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡
⭐ Tags ⭐
- Appium
- mobile testing
- Testing
- Appium Testing
- Java
- Webview Context
⭐ Hashtags ⭐
#Appium #MobileTesting #Testing #SoftwareTesting #Testing #Automation #Java #WebviewContext
Ещё видео!