简体   繁体   中英

Can we change android mobile device date and time through automation script using appium?

In one of my automation tests, I want to update device data and time. I am using appium driver to execute the tests.

You should be able to do it by running adb command with Appium.

Adb command:

adb shell 'date 060910002016.00'

First, try this command in terminal to see if your device allows it for you. Should be fine with emulators.

Appium provides API to run adb command, so depending on your client library it should look similar to this (js example)

await driver.execute('mobile: shell',  {
    'command': 'date',
    'args': ['060910002016.00']
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM