How to lock mobile device?

So I can see there is a Unlock Device command in Katalon which works great. Is there a way to or a command to lock the device?

Hi @mohammad.arif,

To Lock / Unlock device, you could get Appium driver instance from MobileDriverFactory and do it by yourself /=)

import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory
import io.appium.java_client.AppiumDriver
import io.appium.java_client.MobileElement

AppiumDriver<MobileElement> driver = MobileDriverFactory.getDriver()
driver.lockDevice()
driver.unlockDevice()

Hi @thongnmtran - once again thank you so much for this advice, it works beautifully!

1 Like