Appium — Dealing with FLAG_SECURE enabled in application

Applications like Netflix do not allow users to capture screen by enabling FLAG_SECURE ON. This is often done due to security constrains, most of the banking applications also do not allow you to take screenshots of application. In such cases, While trying to automate we wont be able take Screen dump via UiAutomator viewer or using Appium desktop however for testing purposes developers can make a debug build that has FLAG_SECURE flag removed/turned off.

Appium desktop failing to take screenshot

If it’s not possible to turn off the FLAG , one approach we can follow is using driver.getPageSource() from Appium client code which will return element hierarchy in XML which you can use for building locator.

String elementHierarchy = driver.getPageSource();

Once you get the elementHierarchy you can find necessary elements, it wont be as convenient as it would be with UiAutomator viewer or using Appium desktop but still very much possible.

Hope this helps , Happy coding ❤




Engineering at FreeNow Tech.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to: Terraform Locking State in S3

Digital files — Why all the DAM hype? The zen of digital decluttering.

Test-Driven Development — Part 2

Storage Elasticity to Hadoop DateNode using LVM | Resize Static Partition without data loss

How To Begin Learning to Program — Patrick Fluke

Tarento Active Infrastructure Monitoring Service

#CodePlateau; Starter Kit for a Junior Dev

Method Dispatch in Swift

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gokul Menon

Gokul Menon

Engineering at FreeNow Tech.

More from Medium

Elements of Backend

APIs let’s start with the basics shall we? Then read this…

What is Postman?

Getting To Know OAuth 2.0