Appium如何关闭APP?

百度搜了好多,driver.close(), driver.closeApp(), driver.quit(),这些都无法实现。

使用dir函数查看一下driver都有哪些方法哩

dir(driver)

输出:

['AC_OFF', 'AC_ON', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__enter__', '__eq__', '__exit__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_addCommands', '_build_data_matcher', '_file_detector', '_is_remote', '_merge_capabilities', '_mobile', '_switch_to', '_unwrap_value', '_update_command_executor', '_web_element_cls', '_wrap_value', 'activate_app', 'activate_ime_engine', 'active_ime_engine', 'add_cookie', 'all_sessions', 'app_strings', 'application_cache', 'available_ime_engines', 'back', 'background_app', 'battery_info', 'capabilities', 'close', 'close_app', 'command_executor', 'context', 'contexts', 'create_web_element', 'current_activity', 'current_context', 'current_package', 'current_url', 'current_window_handle', 'deactivate_ime_engine', 'delete_all_cookies', 'delete_cookie', 'desired_capabilities', 'device_time', 'drag_and_drop', 'end_test_coverage', 'error_handler', 'events', 'execute', 'execute_async_script', 'execute_driver', 'execute_script', 'file_detector', 'file_detector_context', 'find_element', 'find_element_by_accessibility_id', 'find_element_by_android_data_matcher', 'find_element_by_android_uiautomator', 'find_element_by_android_view_matcher', 'find_element_by_android_viewtag', 'find_element_by_class_name', 'find_element_by_css_selector', 'find_element_by_custom', 'find_element_by_id', 'find_element_by_image', 'find_element_by_ios_class_chain', 'find_element_by_ios_predicate', 'find_element_by_ios_uiautomation', 'find_element_by_link_text', 'find_element_by_name', 'find_element_by_partial_link_text', 'find_element_by_tag_name', 'find_element_by_windows_uiautomation', 'find_element_by_xpath', 'find_elements', 'find_elements_by_accessibility_id', 'find_elements_by_android_data_matcher', 'find_elements_by_android_uiautomator', 'find_elements_by_android_viewtag', 'find_elements_by_class_name', 'find_elements_by_css_selector', 'find_elements_by_custom', 'find_elements_by_id', 'find_elements_by_image', 'find_elements_by_ios_class_chain', 'find_elements_by_ios_predicate', 'find_elements_by_ios_uiautomation', 'find_elements_by_link_text', 'find_elements_by_name', 'find_elements_by_partial_link_text', 'find_elements_by_tag_name', 'find_elements_by_windows_uiautomation', 'find_elements_by_xpath', 'find_image_occurrence', 'finger_print', 'flick', 'forward', 'fullscreen_window', 'get', 'get_clipboard', 'get_clipboard_text', 'get_cookie', 'get_cookies', 'get_device_time', 'get_display_density', 'get_events', 'get_images_similarity', 'get_log', 'get_performance_data', 'get_performance_data_types', 'get_screenshot_as_base64', 'get_screenshot_as_file', 'get_screenshot_as_png', 'get_settings', 'get_system_bars', 'get_window_position', 'get_window_rect', 'get_window_size', 'hide_keyboard', 'implicitly_wait', 'install_app', 'is_app_installed', 'is_ime_active', 'is_keyboard_shown', 'is_locked', 'keyevent', 'launch_app', 'location', 'lock', 'log_event', 'log_types', 'long_press_keycode', 'make_gsm_call', 'match_images_features', 'maximize_window', 'minimize_window', 'mobile', 'name', 'network_connection', 'open_notifications', 'orientation', 'page_source', 'press_button', 'press_keycode', 'pull_file', 'pull_folder', 'push_file', 'query_app_state', 'quit', 'refresh', 'remove_app', 'reset', 'save_screenshot', 'scroll', 'send_sms', 'session', 'session_id', 'set_clipboard', 'set_clipboard_text', 'set_gsm_signal', 'set_gsm_voice', 'set_location', 'set_network_connection', 'set_network_speed', 'set_page_load_timeout', 'set_power_ac', 'set_power_capacity', 'set_script_timeout', 'set_value', 'set_window_position', 'set_window_rect', 'set_window_size', 'shake', 'start_activity', 'start_client', 'start_recording_screen', 'start_session', 'stop_client', 'stop_recording_screen', 'swipe', 'switch_to', 'switch_to_active_element', 'switch_to_alert', 'switch_to_default_content', 'switch_to_frame', 'switch_to_window', 'tap', 'terminate_app', 'title', 'toggle_location_services', 'toggle_touch_id_enrollment', 'toggle_wifi', 'touch_id', 'unlock', 'update_settings', 'w3c', 'wait_activity', 'window_handles']

经过查找,有个terminate_app方法看着很顺眼,尝试一下发现,需要一个app_id参数,这似乎跟启动app时的包名是同一个,例如淘宝为“com.taobao.taobao”,试一下,

driver.terminate('com.taobao.taobao')

嗯,我是可以关闭APP的!你们试一试。

Appium如何关闭APP?相关推荐

  1. 关于 appium 如何关闭 app (已解决)

    说明:该文属于 Python全栈白宝书专栏,免费阶段订阅数量4300+,购买任意白宝书体系化专栏可加入TFS-CLUB 私域社区. 福利:除了通过订阅"白宝书系列专栏"加入社区获取 ...

  2. appium+python 操作APP

    整理一些appium+python操作APP的常用方法 1.检查应用是否已经安装 driver.is_app_installed('package_name') 2.安装APP driver.inst ...

  3. appium python 抓包_Python学习教程:另辟蹊径,appium抓取app应用数据了解一下

    原标题:Python学习教程:另辟蹊径,appium抓取app应用数据了解一下 作为爬虫工程师,没有价格不知道selenium的. 什么是selenium? Selenium原本是一个用于Web应用程 ...

  4. python+appium+雷电模拟器 app自动化测试

    一.环境准备  1.jdk1.8 2.android-sdk-windows 3.appium-desktop-setup-1.11.0(直接搜索appium进入官网下载) 4.Appium-Pyth ...

  5. Appium之Hybrid APP混合应用测试

    目录 前言 1. 解决方案 2. 遇到的问题 2.1 contexts只能获取NATIVE_APP,无法获取WEBVIEW 2.2 已经能够获取到WEBVIEW,但是无法切换到WEBVIEW 前言 在 ...

  6. whitepages 被关闭_除了滑动关闭APP影响电池寿命,还有哪些操作触碰到了你的知识盲区?...

    我们平常使用手机,无论是安卓手机还是苹果iPhone,都会有一个习惯,那就是习惯性关闭后台不使用的应用,觉得不仅可以释放更多内存空间,还可以减少后台运行程序减少耗电. 事实真的是这样的吗? 苹果为此专 ...

  7. coordinatorlayout 设置不可滑动_滑动关闭App损害iPhone电池寿命,我们需要“改掉强迫症”吗?...

    神译局是36氪旗下编译团队,关注科技.商业.职场.生活等领域,重点介绍国外的新技术.新观点.新风向. 编者按:自2013年苹果推出iOS 7系统以来,我们在iOS系统中都是通过滑动关闭App应用的方式 ...

  8. ADB启动或关闭APP

    查看启动的包名及activity adb shell dumpsys activity top | find "ACTIVITY" #find可替换为grep# 实例输出ACTIV ...

  9. 项目后台运行关闭_iOS到底有没有必要上滑强制关闭APP?

    前一阵炒的沸沸扬扬的苹果宣布不需要上滑关闭APP,给我带来了一系列思考,有消息说是为了防止电池消耗过重,事实真是这样么? 话不多说,先上图看看 这就是苹果官网对于强制关闭APP给出的解释,最后一段说明 ...

最新文章

  1. Oracle ORA-03137: TTC protocol internal error : [12333] 故障分析
  2. python神经网络风格_[Deep-Learning-with-Python]使用LSTM生成尼采风格文章
  3. 皮一皮:中国好男友!!!
  4. 基于PYQT编写一个人脸识别软件
  5. 未处理sqlexception中value_plsql异常处理
  6. Spring 2.0技术手册 下载
  7. 比较两个字符串的相似度算法
  8. atxserver运行没有反应_连续生物工艺:灌流生物反应器
  9. PlaceHolder和Panel的区别【搜藏】
  10. ElasticSearch启动报错,报ERROR: [3] bootstrap checks failed
  11. 信息系统项目的应急预案方案_从环评到验收、排污许可证、应急预案,都应在项目什么阶段开展? 先后顺序是什么?...
  12. ANDROID 获得地理位置
  13. 强一致性、弱一致性、最终一致性
  14. Docker 的使用
  15. 【语音隐写】基于matlab DWT音频数字水印嵌入提取【含Matlab源码 350期】
  16. ildasm.exe查看dll库支持的Net版本
  17. filco的pin码_Filco圣手二代双模蓝牙机械键盘连接方法
  18. 麒麟座迷你板STLINK使用
  19. 恭喜!公积金将按月提取!12月31日前,全面执行!
  20. 机器学习方法:回归(一):线性回归Linear regression

热门文章

  1. 微信小程序之卡片瀑布流
  2. 设置IDEN修改html、jsp后立即生效不需要重启项目(自用)
  3. 网站安全狗Nginx版V2.0发布 全方位防护网站安全
  4. 跟着左程云学面试算法
  5. 9种最常用数据分析方法,解决90%分析难题
  6. GroupBox 控件 RadioButton控件
  7. EasyUI ComboTree默认折叠全部节点
  8. 202x年智能微模块数据中心解决方案(专业完整版)
  9. BES的ANC之FF,FB,MC功能
  10. 手摸手系列之EasyPoi导出Excel横向遍历实战