How To Check If Your Android Phone Is Rooted?

Hello everyone,
I’m looking to find an Appium function that could indicate if the android phone is rooted or not.
If there’s an already builded function, please let me know, else, how to do to check if the phone is rooted?
Any help is appreciated.
Thank you.

I would try to use adb or other command line tools, and not some specialized AppiumLibrary keywords.
(But don’t know if Appium have something for this)

1 Like

Yeah, I would try a Run command from OperatingSystem for adb and check the output. And then, based on a condition, you can determine if the device is rooted or not

1 Like

Hi @zastress ,

Can you tell me those commands to check.How to use while writing scripts using robot framework

1 Like

Thank you HelioGuilherme66 , zastress and Dinesh for your reply.
I’m actually looking to achieve that via Robot Framework as Dinesh suggested. Is it possible?
Thank you again.

you can use the adb shell command to check if the phone is rooted. Execute adb shell su and if the phone is rooted a root shell will be opened. If it’s not rooted you will get a su: not found error message.

3 Likes