获取APP页面源码并写入一个XML文件
page_source=driver.page_source
with open("data.xml","w") as f:
f.writelines(page_source)
将UTC时间转换为指定格式时间 localtime()
timeStruct = time.localtime(os.path.getmtime(oldname))
print timeStruct
print time.strftime('%Y-%m-%d %H:%M:%S',timeStruct)
输出python日志
stdout_backup = sys.stdout
log_file = open("message.log", "w")
sys.stdout = log_file
print u'输出这一段的print内容到message.log里'
print u'这里就是日志的内容!'
log_file.close()
sys.stdout = stdout_backup
开关WiFi 和 移动数据网络
***参数需要修改
Turn on wifi - adb shell am start -n io.appium.settings/.Settings -e wifi on
Turn off WiFi - adb shell am start -n io.appium.settings/.Settings -e wifi off
Turn on mobile data - adb shell am start -n io.appium.settings/.Settings -e data on
Turn off mobile data - adb shell am start -n io.appium.settings/.Settings -e data off