Appium-Python-Client 5.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- appium/__init__.py +17 -0
- appium/common/__init__.py +17 -0
- appium/common/exceptions.py +26 -0
- appium/common/helper.py +42 -0
- appium/common/logger.py +28 -0
- appium/options/__init__.py +0 -0
- appium/options/android/__init__.py +2 -0
- appium/options/android/common/__init__.py +0 -0
- appium/options/android/common/adb/__init__.py +0 -0
- appium/options/android/common/adb/adb_exec_timeout_option.py +41 -0
- appium/options/android/common/adb/adb_port_option.py +38 -0
- appium/options/android/common/adb/allow_delay_adb_option.py +39 -0
- appium/options/android/common/adb/build_tools_version_option.py +42 -0
- appium/options/android/common/adb/clear_device_logs_on_start_option.py +40 -0
- appium/options/android/common/adb/ignore_hidden_api_policy_error_option.py +40 -0
- appium/options/android/common/adb/logcat_filter_specs_option.py +42 -0
- appium/options/android/common/adb/logcat_format_option.py +39 -0
- appium/options/android/common/adb/mock_location_app_option.py +42 -0
- appium/options/android/common/adb/remote_adb_host_option.py +39 -0
- appium/options/android/common/adb/skip_logcat_capture_option.py +40 -0
- appium/options/android/common/adb/suppress_kill_server_option.py +39 -0
- appium/options/android/common/app/__init__.py +0 -0
- appium/options/android/common/app/allow_test_packages_option.py +40 -0
- appium/options/android/common/app/android_install_timeout_option.py +43 -0
- appium/options/android/common/app/app_activity_option.py +39 -0
- appium/options/android/common/app/app_package_option.py +39 -0
- appium/options/android/common/app/app_wait_activity_option.py +40 -0
- appium/options/android/common/app/app_wait_duration_option.py +41 -0
- appium/options/android/common/app/app_wait_for_launch_option.py +41 -0
- appium/options/android/common/app/app_wait_package_option.py +40 -0
- appium/options/android/common/app/auto_grant_premissions_option.py +40 -0
- appium/options/android/common/app/enforce_app_install_option.py +40 -0
- appium/options/android/common/app/intent_action_option.py +40 -0
- appium/options/android/common/app/intent_category_option.py +40 -0
- appium/options/android/common/app/intent_flags_option.py +40 -0
- appium/options/android/common/app/optional_intent_arguments_option.py +40 -0
- appium/options/android/common/app/remote_apps_cache_limit_option.py +42 -0
- appium/options/android/common/app/uninstall_other_packages_option.py +39 -0
- appium/options/android/common/avd/__init__.py +0 -0
- appium/options/android/common/avd/avd_args_option.py +38 -0
- appium/options/android/common/avd/avd_env_option.py +38 -0
- appium/options/android/common/avd/avd_launch_timeout_option.py +41 -0
- appium/options/android/common/avd/avd_option.py +41 -0
- appium/options/android/common/avd/avd_ready_timeout_option.py +41 -0
- appium/options/android/common/avd/gps_enabled_option.py +39 -0
- appium/options/android/common/avd/network_speed_option.py +41 -0
- appium/options/android/common/context/__init__.py +0 -0
- appium/options/android/common/context/auto_webview_timeout_option.py +41 -0
- appium/options/android/common/context/chrome_logging_prefs_option.py +41 -0
- appium/options/android/common/context/chrome_options_option.py +40 -0
- appium/options/android/common/context/chromedriver_args_option.py +41 -0
- appium/options/android/common/context/chromedriver_chrome_mapping_file_option.py +43 -0
- appium/options/android/common/context/chromedriver_disable_build_check_option.py +41 -0
- appium/options/android/common/context/chromedriver_executable_dir_option.py +43 -0
- appium/options/android/common/context/chromedriver_executable_option.py +38 -0
- appium/options/android/common/context/chromedriver_port_option.py +39 -0
- appium/options/android/common/context/chromedriver_ports_option.py +39 -0
- appium/options/android/common/context/chromedriver_use_system_executable_option.py +40 -0
- appium/options/android/common/context/ensure_webviews_have_pages_option.py +40 -0
- appium/options/android/common/context/extract_chrome_android_package_from_context_name_option.py +40 -0
- appium/options/android/common/context/native_web_screenshot_option.py +40 -0
- appium/options/android/common/context/recreate_chrome_driver_sessions_option.py +41 -0
- appium/options/android/common/context/show_chromedriver_log_option.py +39 -0
- appium/options/android/common/context/webview_devtools_port_option.py +40 -0
- appium/options/android/common/localization/__init__.py +0 -0
- appium/options/android/common/localization/locale_script_option.py +40 -0
- appium/options/android/common/locking/__init__.py +0 -0
- appium/options/android/common/locking/skip_unlock_option.py +42 -0
- appium/options/android/common/locking/unlock_key_option.py +40 -0
- appium/options/android/common/locking/unlock_strategy_option.py +40 -0
- appium/options/android/common/locking/unlock_success_timeout_option.py +43 -0
- appium/options/android/common/locking/unlock_type_option.py +40 -0
- appium/options/android/common/mjpeg/__init__.py +0 -0
- appium/options/android/common/mjpeg/mjpeg_screenshot_url_option.py +40 -0
- appium/options/android/common/other/__init__.py +0 -0
- appium/options/android/common/other/disable_suppress_accessibility_service_option.py +40 -0
- appium/options/android/common/other/user_profile_option.py +42 -0
- appium/options/android/common/signing/__init__.py +0 -0
- appium/options/android/common/signing/key_alias_option.py +40 -0
- appium/options/android/common/signing/key_password_option.py +40 -0
- appium/options/android/common/signing/keystore_password_option.py +40 -0
- appium/options/android/common/signing/keystore_path_option.py +40 -0
- appium/options/android/common/signing/no_sign_option.py +42 -0
- appium/options/android/common/signing/use_keystore_option.py +42 -0
- appium/options/android/espresso/__init__.py +0 -0
- appium/options/android/espresso/activity_options_option.py +41 -0
- appium/options/android/espresso/app_locale_option.py +44 -0
- appium/options/android/espresso/base.py +221 -0
- appium/options/android/espresso/espresso_build_config_option.py +46 -0
- appium/options/android/espresso/espresso_server_launch_timeout_option.py +43 -0
- appium/options/android/espresso/force_espresso_rebuild_option.py +41 -0
- appium/options/android/espresso/intent_options_option.py +41 -0
- appium/options/android/espresso/show_gradle_log_option.py +39 -0
- appium/options/android/uiautomator2/__init__.py +0 -0
- appium/options/android/uiautomator2/base.py +221 -0
- appium/options/android/uiautomator2/disable_window_animation_option.py +40 -0
- appium/options/android/uiautomator2/mjpeg_server_port_option.py +41 -0
- appium/options/android/uiautomator2/skip_device_initialization_option.py +40 -0
- appium/options/android/uiautomator2/skip_server_installation_option.py +44 -0
- appium/options/android/uiautomator2/uiautomator2_server_install_timeout_option.py +44 -0
- appium/options/android/uiautomator2/uiautomator2_server_launch_timeout_option.py +44 -0
- appium/options/android/uiautomator2/uiautomator2_server_read_timeout_option.py +46 -0
- appium/options/common/__init__.py +1 -0
- appium/options/common/app_option.py +41 -0
- appium/options/common/auto_web_view_option.py +40 -0
- appium/options/common/automation_name_option.py +38 -0
- appium/options/common/base.py +125 -0
- appium/options/common/browser_name_option.py +38 -0
- appium/options/common/bundle_id_option.py +38 -0
- appium/options/common/clear_system_files_option.py +38 -0
- appium/options/common/device_name_option.py +38 -0
- appium/options/common/enable_performance_logging_option.py +38 -0
- appium/options/common/event_timings_option.py +40 -0
- appium/options/common/full_reset_option.py +38 -0
- appium/options/common/is_headless_option.py +39 -0
- appium/options/common/language_option.py +38 -0
- appium/options/common/locale_option.py +38 -0
- appium/options/common/new_command_timeout_option.py +41 -0
- appium/options/common/no_reset_option.py +38 -0
- appium/options/common/orientation_option.py +40 -0
- appium/options/common/other_apps_option.py +39 -0
- appium/options/common/platform_version_option.py +40 -0
- appium/options/common/postrun_option.py +39 -0
- appium/options/common/prerun_option.py +40 -0
- appium/options/common/print_page_source_on_find_failure_option.py +40 -0
- appium/options/common/skip_log_capture_option.py +38 -0
- appium/options/common/supports_capabilities.py +26 -0
- appium/options/common/system_host_option.py +38 -0
- appium/options/common/system_port_option.py +38 -0
- appium/options/common/udid_option.py +38 -0
- appium/options/flutter_integration/__init__.py +15 -0
- appium/options/flutter_integration/base.py +39 -0
- appium/options/flutter_integration/flutter_element_wait_timeout_option.py +50 -0
- appium/options/flutter_integration/flutter_enable_mock_camera_option.py +44 -0
- appium/options/flutter_integration/flutter_server_launch_timeout_option.py +51 -0
- appium/options/flutter_integration/flutter_system_port_option.py +45 -0
- appium/options/gecko/__init__.py +1 -0
- appium/options/gecko/android_storage_option.py +39 -0
- appium/options/gecko/base.py +51 -0
- appium/options/gecko/firefox_options_option.py +38 -0
- appium/options/gecko/marionette_port_option.py +43 -0
- appium/options/gecko/verbosity_option.py +40 -0
- appium/options/ios/__init__.py +2 -0
- appium/options/ios/safari/__init__.py +0 -0
- appium/options/ios/safari/automatic_inspection_option.py +41 -0
- appium/options/ios/safari/automatic_profiling_option.py +41 -0
- appium/options/ios/safari/base.py +51 -0
- appium/options/ios/safari/device_name_option.py +43 -0
- appium/options/ios/safari/device_type_option.py +41 -0
- appium/options/ios/safari/device_udid_option.py +43 -0
- appium/options/ios/safari/platform_build_version_option.py +41 -0
- appium/options/ios/safari/platform_version_option.py +41 -0
- appium/options/ios/safari/use_simulator_option.py +41 -0
- appium/options/ios/safari/webkit_webrtc_option.py +52 -0
- appium/options/ios/xcuitest/__init__.py +0 -0
- appium/options/ios/xcuitest/app/__init__.py +0 -0
- appium/options/ios/xcuitest/app/app_install_strategy_option.py +46 -0
- appium/options/ios/xcuitest/app/app_push_timeout_option.py +42 -0
- appium/options/ios/xcuitest/app/localizable_strings_dir_option.py +39 -0
- appium/options/ios/xcuitest/base.py +223 -0
- appium/options/ios/xcuitest/general/__init__.py +0 -0
- appium/options/ios/xcuitest/general/include_device_caps_to_session_info_option.py +41 -0
- appium/options/ios/xcuitest/general/reset_location_service_option.py +39 -0
- appium/options/ios/xcuitest/other/__init__.py +0 -0
- appium/options/ios/xcuitest/other/command_timeouts_option.py +57 -0
- appium/options/ios/xcuitest/other/launch_with_idb_option.py +42 -0
- appium/options/ios/xcuitest/other/show_ios_log_option.py +39 -0
- appium/options/ios/xcuitest/other/use_json_source_option.py +39 -0
- appium/options/ios/xcuitest/simulator/__init__.py +0 -0
- appium/options/ios/xcuitest/simulator/calendar_access_authorized_option.py +41 -0
- appium/options/ios/xcuitest/simulator/calendar_format_option.py +38 -0
- appium/options/ios/xcuitest/simulator/connect_hardware_keyboard_option.py +43 -0
- appium/options/ios/xcuitest/simulator/custom_ssl_cert_option.py +39 -0
- appium/options/ios/xcuitest/simulator/enforce_fresh_simulator_creation_option.py +39 -0
- appium/options/ios/xcuitest/simulator/force_simulator_software_keyboard_presence_option.py +45 -0
- appium/options/ios/xcuitest/simulator/ios_simulator_logs_predicate_option.py +38 -0
- appium/options/ios/xcuitest/simulator/keep_key_chains_option.py +39 -0
- appium/options/ios/xcuitest/simulator/keychains_exclude_patterns_option.py +44 -0
- appium/options/ios/xcuitest/simulator/permissions_option.py +50 -0
- appium/options/ios/xcuitest/simulator/reduce_motion_option.py +40 -0
- appium/options/ios/xcuitest/simulator/reset_on_session_start_only_option.py +41 -0
- appium/options/ios/xcuitest/simulator/scale_factor_option.py +44 -0
- appium/options/ios/xcuitest/simulator/shutdown_other_simulators_option.py +44 -0
- appium/options/ios/xcuitest/simulator/simulator_devices_set_path_option.py +41 -0
- appium/options/ios/xcuitest/simulator/simulator_pasteboard_automatic_sync_option.py +42 -0
- appium/options/ios/xcuitest/simulator/simulator_startup_timeout_option.py +46 -0
- appium/options/ios/xcuitest/simulator/simulator_trace_pointer_option.py +41 -0
- appium/options/ios/xcuitest/simulator/simulator_window_center_option.py +41 -0
- appium/options/ios/xcuitest/wda/__init__.py +0 -0
- appium/options/ios/xcuitest/wda/allow_provisioning_device_regitration_option.py +40 -0
- appium/options/ios/xcuitest/wda/auto_accept_alerts_option.py +39 -0
- appium/options/ios/xcuitest/wda/auto_disimiss_alerts_option.py +39 -0
- appium/options/ios/xcuitest/wda/derived_data_path_option.py +41 -0
- appium/options/ios/xcuitest/wda/disable_automatic_screenshots_option.py +40 -0
- appium/options/ios/xcuitest/wda/force_app_launch_option.py +42 -0
- appium/options/ios/xcuitest/wda/keychain_password_option.py +39 -0
- appium/options/ios/xcuitest/wda/keychain_path_option.py +39 -0
- appium/options/ios/xcuitest/wda/max_typing_frequency_option.py +40 -0
- appium/options/ios/xcuitest/wda/mjpeg_server_port_option.py +42 -0
- appium/options/ios/xcuitest/wda/process_arguments_option.py +42 -0
- appium/options/ios/xcuitest/wda/result_bundle_path_option.py +42 -0
- appium/options/ios/xcuitest/wda/screenshot_quality_option.py +42 -0
- appium/options/ios/xcuitest/wda/should_terminate_app_option.py +42 -0
- appium/options/ios/xcuitest/wda/should_use_singleton_test_manager_option.py +39 -0
- appium/options/ios/xcuitest/wda/show_xcode_log_option.py +40 -0
- appium/options/ios/xcuitest/wda/simple_is_visible_check_option.py +42 -0
- appium/options/ios/xcuitest/wda/updated_wda_bundle_id_option.py +39 -0
- appium/options/ios/xcuitest/wda/use_native_caching_strategy_option.py +41 -0
- appium/options/ios/xcuitest/wda/use_new_wda_option.py +51 -0
- appium/options/ios/xcuitest/wda/use_prebuilt_wda_option.py +39 -0
- appium/options/ios/xcuitest/wda/use_simple_build_test_option.py +40 -0
- appium/options/ios/xcuitest/wda/use_xctestrun_file_option.py +49 -0
- appium/options/ios/xcuitest/wda/wait_for_idle_timeout_option.py +45 -0
- appium/options/ios/xcuitest/wda/wait_for_quiescence_option.py +42 -0
- appium/options/ios/xcuitest/wda/wda_base_url_option.py +41 -0
- appium/options/ios/xcuitest/wda/wda_connection_timeout_option.py +43 -0
- appium/options/ios/xcuitest/wda/wda_eventloop_idle_delay_option.py +46 -0
- appium/options/ios/xcuitest/wda/wda_launch_timeout_option.py +41 -0
- appium/options/ios/xcuitest/wda/wda_local_port_option.py +41 -0
- appium/options/ios/xcuitest/wda/wda_startup_retries_option.py +39 -0
- appium/options/ios/xcuitest/wda/wda_startup_retry_interval_option.py +43 -0
- appium/options/ios/xcuitest/wda/web_driver_agent_url_option.py +39 -0
- appium/options/ios/xcuitest/wda/xcode_org_id_option.py +39 -0
- appium/options/ios/xcuitest/wda/xcode_signing_id_option.py +39 -0
- appium/options/ios/xcuitest/webview/__init__.py +0 -0
- appium/options/ios/xcuitest/webview/absolute_web_locations_option.py +42 -0
- appium/options/ios/xcuitest/webview/additional_webview_bundle_ids_option.py +40 -0
- appium/options/ios/xcuitest/webview/enable_async_execute_from_https_option.py +39 -0
- appium/options/ios/xcuitest/webview/full_context_list_option.py +42 -0
- appium/options/ios/xcuitest/webview/include_safari_in_webviews_option.py +41 -0
- appium/options/ios/xcuitest/webview/native_web_tap_option.py +40 -0
- appium/options/ios/xcuitest/webview/safari_garbage_collect_option.py +39 -0
- appium/options/ios/xcuitest/webview/safari_ignore_fraud_warning_option.py +39 -0
- appium/options/ios/xcuitest/webview/safari_ignore_web_hostnames_option.py +42 -0
- appium/options/ios/xcuitest/webview/safari_initial_url_option.py +38 -0
- appium/options/ios/xcuitest/webview/safari_log_all_communication_hex_dump_option.py +43 -0
- appium/options/ios/xcuitest/webview/safari_log_all_communication_option.py +40 -0
- appium/options/ios/xcuitest/webview/safari_open_links_in_background_option.py +39 -0
- appium/options/ios/xcuitest/webview/safari_socket_chunk_size_option.py +41 -0
- appium/options/ios/xcuitest/webview/safari_web_inspector_max_frame_length_option.py +41 -0
- appium/options/ios/xcuitest/webview/webkit_response_timeout_option.py +43 -0
- appium/options/ios/xcuitest/webview/webview_connect_retries_option.py +40 -0
- appium/options/ios/xcuitest/webview/webview_connect_timeout_option.py +43 -0
- appium/options/mac/__init__.py +1 -0
- appium/options/mac/mac2/__init__.py +0 -0
- appium/options/mac/mac2/app_path_option.py +39 -0
- appium/options/mac/mac2/arguments_option.py +39 -0
- appium/options/mac/mac2/base.py +113 -0
- appium/options/mac/mac2/bootstrap_root_option.py +41 -0
- appium/options/mac/mac2/environment_option.py +41 -0
- appium/options/mac/mac2/server_startup_timeout_option.py +44 -0
- appium/options/mac/mac2/show_server_logs_option.py +39 -0
- appium/options/mac/mac2/skip_app_kill_option.py +40 -0
- appium/options/mac/mac2/web_driver_agent_mac_url_option.py +39 -0
- appium/options/windows/__init__.py +1 -0
- appium/options/windows/windows/__init__.py +0 -0
- appium/options/windows/windows/app_arguments_option.py +40 -0
- appium/options/windows/windows/app_top_level_window_option.py +40 -0
- appium/options/windows/windows/app_working_dir_option.py +40 -0
- appium/options/windows/windows/base.py +97 -0
- appium/options/windows/windows/create_session_timeout_option.py +45 -0
- appium/options/windows/windows/expreimental_web_driver_option.py +39 -0
- appium/options/windows/windows/wait_for_app_launch_option.py +43 -0
- appium/protocols/__init__.py +13 -0
- appium/protocols/webdriver/__init__.py +13 -0
- appium/protocols/webdriver/can_execute_commands.py +23 -0
- appium/protocols/webdriver/can_execute_scripts.py +27 -0
- appium/protocols/webdriver/can_find_elements.py +32 -0
- appium/protocols/webdriver/can_remember_extension_presence.py +23 -0
- appium/py.typed +0 -0
- appium/version.py +22 -0
- appium/webdriver/__init__.py +20 -0
- appium/webdriver/appium_connection.py +65 -0
- appium/webdriver/appium_service.py +330 -0
- appium/webdriver/applicationstate.py +21 -0
- appium/webdriver/client_config.py +38 -0
- appium/webdriver/clipboard_content_type.py +19 -0
- appium/webdriver/command_method.py +27 -0
- appium/webdriver/common/__init__.py +17 -0
- appium/webdriver/common/appiumby.py +54 -0
- appium/webdriver/connectiontype.py +42 -0
- appium/webdriver/errorhandler.py +125 -0
- appium/webdriver/extensions/__init__.py +13 -0
- appium/webdriver/extensions/action_helpers.py +188 -0
- appium/webdriver/extensions/android/__init__.py +0 -0
- appium/webdriver/extensions/android/activities.py +65 -0
- appium/webdriver/extensions/android/common.py +59 -0
- appium/webdriver/extensions/android/display.py +48 -0
- appium/webdriver/extensions/android/gsm.py +147 -0
- appium/webdriver/extensions/android/nativekey.py +1119 -0
- appium/webdriver/extensions/android/network.py +175 -0
- appium/webdriver/extensions/android/performance.py +85 -0
- appium/webdriver/extensions/android/power.py +80 -0
- appium/webdriver/extensions/android/sms.py +50 -0
- appium/webdriver/extensions/android/system_bars.py +58 -0
- appium/webdriver/extensions/applications.py +274 -0
- appium/webdriver/extensions/clipboard.py +107 -0
- appium/webdriver/extensions/context.py +63 -0
- appium/webdriver/extensions/device_time.py +75 -0
- appium/webdriver/extensions/execute_driver.py +60 -0
- appium/webdriver/extensions/execute_mobile_command.py +62 -0
- appium/webdriver/extensions/flutter_integration/__init__.py +13 -0
- appium/webdriver/extensions/flutter_integration/flutter_commands.py +296 -0
- appium/webdriver/extensions/flutter_integration/flutter_finder.py +55 -0
- appium/webdriver/extensions/flutter_integration/scroll_directions.py +6 -0
- appium/webdriver/extensions/hw_actions.py +149 -0
- appium/webdriver/extensions/images_comparison.py +132 -0
- appium/webdriver/extensions/keyboard.py +168 -0
- appium/webdriver/extensions/location.py +98 -0
- appium/webdriver/extensions/log_event.py +68 -0
- appium/webdriver/extensions/logs.py +53 -0
- appium/webdriver/extensions/remote_fs.py +110 -0
- appium/webdriver/extensions/screen_record.py +207 -0
- appium/webdriver/extensions/session.py +41 -0
- appium/webdriver/extensions/settings.py +49 -0
- appium/webdriver/locator_converter.py +29 -0
- appium/webdriver/mobilecommand.py +104 -0
- appium/webdriver/switch_to.py +35 -0
- appium/webdriver/webdriver.py +495 -0
- appium/webdriver/webelement.py +130 -0
- appium_python_client-5.2.0.dist-info/METADATA +573 -0
- appium_python_client-5.2.0.dist-info/RECORD +324 -0
- appium_python_client-5.2.0.dist-info/WHEEL +4 -0
- appium_python_client-5.2.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from selenium.common.exceptions import UnknownMethodException
|
|
16
|
+
from typing_extensions import Self
|
|
17
|
+
|
|
18
|
+
from appium.common.helper import extract_const_attributes
|
|
19
|
+
from appium.common.logger import logger
|
|
20
|
+
from appium.protocols.webdriver.can_execute_commands import CanExecuteCommands
|
|
21
|
+
from appium.protocols.webdriver.can_execute_scripts import CanExecuteScripts
|
|
22
|
+
from appium.protocols.webdriver.can_remember_extension_presence import CanRememberExtensionPresence
|
|
23
|
+
from appium.webdriver.mobilecommand import MobileCommand as Command
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class NetSpeed:
|
|
27
|
+
GSM = 'gsm' # GSM/CSD (up: 14.4(kbps), down: 14.4(kbps))
|
|
28
|
+
SCSD = 'scsd' # HSCSD (up: 14.4, down: 57.6)
|
|
29
|
+
GPRS = 'gprs' # GPRS (up: 28.8, down: 57.6)
|
|
30
|
+
EDGE = 'edge' # EDGE/EGPRS (up: 473.6, down: 473.6)
|
|
31
|
+
UMTS = 'umts' # UMTS/3G (up: 384.0, down: 384.0)
|
|
32
|
+
HSDPA = 'hsdpa' # HSDPA (up: 5760.0, down: 13,980.0)
|
|
33
|
+
LTE = 'lte' # LTE (up: 58,000, down: 173,000)
|
|
34
|
+
EVDO = 'evdo' # EVDO (up: 75,000, down: 280,000)
|
|
35
|
+
FULL = 'full' # No limit, the default (up: 0.0, down: 0.0)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class NetworkMask:
|
|
39
|
+
WIFI = 0b010
|
|
40
|
+
DATA = 0b100
|
|
41
|
+
AIRPLANE_MODE = 0b001
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class Network(CanExecuteCommands, CanExecuteScripts, CanRememberExtensionPresence):
|
|
45
|
+
@property
|
|
46
|
+
def network_connection(self) -> int:
|
|
47
|
+
"""Returns an integer bitmask specifying the network connection type.
|
|
48
|
+
|
|
49
|
+
Android only.
|
|
50
|
+
Possible values are available through the enumeration `appium.webdriver.ConnectionType`
|
|
51
|
+
|
|
52
|
+
This API only works reliably on emulators (any version) and real devices
|
|
53
|
+
since API level 31.
|
|
54
|
+
"""
|
|
55
|
+
ext_name = 'mobile: getConnectivity'
|
|
56
|
+
try:
|
|
57
|
+
result_map = self.assert_extension_exists(ext_name).execute_script(ext_name)
|
|
58
|
+
return (
|
|
59
|
+
(NetworkMask.WIFI if result_map['wifi'] else 0)
|
|
60
|
+
| (NetworkMask.DATA if result_map['data'] else 0)
|
|
61
|
+
| (NetworkMask.AIRPLANE_MODE if result_map['airplaneMode'] else 0)
|
|
62
|
+
)
|
|
63
|
+
except UnknownMethodException:
|
|
64
|
+
# TODO: Remove the fallback
|
|
65
|
+
return self.mark_extension_absence(ext_name).execute(Command.GET_NETWORK_CONNECTION, {})['value']
|
|
66
|
+
|
|
67
|
+
def set_network_connection(self, connection_type: int) -> int:
|
|
68
|
+
"""Sets the network connection type. Android only.
|
|
69
|
+
|
|
70
|
+
Possible values:
|
|
71
|
+
|
|
72
|
+
+--------------------+------+------+---------------+
|
|
73
|
+
| Value (Alias) | Data | Wifi | Airplane Mode |
|
|
74
|
+
+====================+======+======+===============+
|
|
75
|
+
| 0 (None) | 0 | 0 | 0 |
|
|
76
|
+
+--------------------+------+------+---------------+
|
|
77
|
+
| 1 (Airplane Mode) | 0 | 0 | 1 |
|
|
78
|
+
+--------------------+------+------+---------------+
|
|
79
|
+
| 2 (Wifi only) | 0 | 1 | 0 |
|
|
80
|
+
+--------------------+------+------+---------------+
|
|
81
|
+
| 4 (Data only) | 1 | 0 | 0 |
|
|
82
|
+
+--------------------+------+------+---------------+
|
|
83
|
+
| 6 (All network on) | 1 | 1 | 0 |
|
|
84
|
+
+--------------------+------+------+---------------+
|
|
85
|
+
|
|
86
|
+
These are available through the enumeration `appium.webdriver.ConnectionType`
|
|
87
|
+
|
|
88
|
+
This API only works reliably on emulators (any version) and real devices
|
|
89
|
+
since API level 31.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
connection_type: a member of the enum `appium.webdriver.ConnectionType`
|
|
93
|
+
|
|
94
|
+
Return:
|
|
95
|
+
int: Set network connection type
|
|
96
|
+
"""
|
|
97
|
+
ext_name = 'mobile: setConnectivity'
|
|
98
|
+
try:
|
|
99
|
+
return self.assert_extension_exists(ext_name).execute_script(
|
|
100
|
+
ext_name,
|
|
101
|
+
{
|
|
102
|
+
'wifi': bool(connection_type & NetworkMask.WIFI),
|
|
103
|
+
'data': bool(connection_type & NetworkMask.DATA),
|
|
104
|
+
'airplaneMode': bool(connection_type & NetworkMask.AIRPLANE_MODE),
|
|
105
|
+
},
|
|
106
|
+
)
|
|
107
|
+
except UnknownMethodException:
|
|
108
|
+
# TODO: Remove the fallback
|
|
109
|
+
return self.mark_extension_absence(ext_name).execute(
|
|
110
|
+
Command.SET_NETWORK_CONNECTION, {'parameters': {'type': connection_type}}
|
|
111
|
+
)['value']
|
|
112
|
+
|
|
113
|
+
def toggle_wifi(self) -> Self:
|
|
114
|
+
"""Toggle the wifi on the device, Android only.
|
|
115
|
+
This API only works reliably on emulators (any version) and real devices
|
|
116
|
+
since API level 31.
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
Union['WebDriver', 'Network']: Self instance
|
|
120
|
+
"""
|
|
121
|
+
ext_name = 'mobile: setConnectivity'
|
|
122
|
+
try:
|
|
123
|
+
self.assert_extension_exists(ext_name).execute_script(
|
|
124
|
+
ext_name, {'wifi': not (self.network_connection & NetworkMask.WIFI)}
|
|
125
|
+
)
|
|
126
|
+
except UnknownMethodException:
|
|
127
|
+
self.mark_extension_absence(ext_name).execute(Command.TOGGLE_WIFI, {})
|
|
128
|
+
return self
|
|
129
|
+
|
|
130
|
+
def set_network_speed(self, speed_type: str) -> Self:
|
|
131
|
+
"""Set the network speed emulation.
|
|
132
|
+
|
|
133
|
+
Android Emulator only.
|
|
134
|
+
|
|
135
|
+
Args:
|
|
136
|
+
speed_type: The network speed type.
|
|
137
|
+
A member of the const appium.webdriver.extensions.android.network.NetSpeed.
|
|
138
|
+
|
|
139
|
+
Usage:
|
|
140
|
+
self.driver.set_network_speed(NetSpeed.LTE)
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
Union['WebDriver', 'Network']: Self instance
|
|
144
|
+
"""
|
|
145
|
+
constants = extract_const_attributes(NetSpeed)
|
|
146
|
+
if speed_type not in constants.values():
|
|
147
|
+
logger.warning(
|
|
148
|
+
f'{speed_type} is unknown. Consider using one of {list(constants.keys())} constants. '
|
|
149
|
+
f'(e.g. {NetSpeed.__name__}.LTE)'
|
|
150
|
+
)
|
|
151
|
+
ext_name = 'mobile: networkSpeed'
|
|
152
|
+
try:
|
|
153
|
+
self.assert_extension_exists(ext_name).execute_script(ext_name, {'speed': speed_type})
|
|
154
|
+
except UnknownMethodException:
|
|
155
|
+
# TODO: Remove the fallback
|
|
156
|
+
self.mark_extension_absence(ext_name).execute(Command.SET_NETWORK_SPEED, {'netspeed': speed_type})
|
|
157
|
+
return self
|
|
158
|
+
|
|
159
|
+
def _add_commands(self) -> None:
|
|
160
|
+
self.command_executor.add_command(Command.TOGGLE_WIFI, 'POST', '/session/$sessionId/appium/device/toggle_wifi')
|
|
161
|
+
self.command_executor.add_command(
|
|
162
|
+
Command.GET_NETWORK_CONNECTION,
|
|
163
|
+
'GET',
|
|
164
|
+
'/session/$sessionId/network_connection',
|
|
165
|
+
)
|
|
166
|
+
self.command_executor.add_command(
|
|
167
|
+
Command.SET_NETWORK_CONNECTION,
|
|
168
|
+
'POST',
|
|
169
|
+
'/session/$sessionId/network_connection',
|
|
170
|
+
)
|
|
171
|
+
self.command_executor.add_command(
|
|
172
|
+
Command.SET_NETWORK_SPEED,
|
|
173
|
+
'POST',
|
|
174
|
+
'/session/$sessionId/appium/device/network_speed',
|
|
175
|
+
)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from typing import Dict, List, Union
|
|
16
|
+
|
|
17
|
+
from selenium.common.exceptions import UnknownMethodException
|
|
18
|
+
|
|
19
|
+
from appium.protocols.webdriver.can_execute_commands import CanExecuteCommands
|
|
20
|
+
from appium.protocols.webdriver.can_execute_scripts import CanExecuteScripts
|
|
21
|
+
from appium.protocols.webdriver.can_remember_extension_presence import CanRememberExtensionPresence
|
|
22
|
+
from appium.webdriver.mobilecommand import MobileCommand as Command
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class Performance(CanExecuteCommands, CanExecuteScripts, CanRememberExtensionPresence):
|
|
26
|
+
def get_performance_data(
|
|
27
|
+
self, package_name: str, data_type: str, data_read_timeout: Union[int, None] = None
|
|
28
|
+
) -> List[List[str]]:
|
|
29
|
+
"""Returns the information of the system state
|
|
30
|
+
which is supported to read as like cpu, memory, network traffic, and battery.
|
|
31
|
+
|
|
32
|
+
Android only.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
package_name: The package name of the application
|
|
36
|
+
data_type: The type of system state which wants to read.
|
|
37
|
+
It should be one of the supported performance data types.
|
|
38
|
+
Check :func:`.get_performance_data_types` for supported types
|
|
39
|
+
data_read_timeout: The number of attempts to read
|
|
40
|
+
|
|
41
|
+
Usage:
|
|
42
|
+
self.driver.get_performance_data('my.app.package', 'cpuinfo', 5)
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
The data along to `data_type`
|
|
46
|
+
"""
|
|
47
|
+
ext_name = 'mobile: getPerformanceData'
|
|
48
|
+
args: Dict[str, Union[str, int]] = {'packageName': package_name, 'dataType': data_type}
|
|
49
|
+
try:
|
|
50
|
+
return self.assert_extension_exists(ext_name).execute_script(ext_name, args)
|
|
51
|
+
except UnknownMethodException:
|
|
52
|
+
# TODO: Remove the fallback
|
|
53
|
+
if data_read_timeout is not None:
|
|
54
|
+
args['dataReadTimeout'] = data_read_timeout
|
|
55
|
+
return self.mark_extension_absence(ext_name).execute(Command.GET_PERFORMANCE_DATA, args)['value']
|
|
56
|
+
|
|
57
|
+
def get_performance_data_types(self) -> List[str]:
|
|
58
|
+
"""Returns the information types of the system state
|
|
59
|
+
which is supported to read as like cpu, memory, network traffic, and battery.
|
|
60
|
+
Android only.
|
|
61
|
+
|
|
62
|
+
Usage:
|
|
63
|
+
self.driver.get_performance_data_types()
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
Available data types
|
|
67
|
+
"""
|
|
68
|
+
ext_name = 'mobile: getPerformanceDataTypes'
|
|
69
|
+
try:
|
|
70
|
+
return self.assert_extension_exists(ext_name).execute_script(ext_name)
|
|
71
|
+
except UnknownMethodException:
|
|
72
|
+
# TODO: Remove the fallback
|
|
73
|
+
return self.mark_extension_absence(ext_name).execute(Command.GET_PERFORMANCE_DATA_TYPES)['value']
|
|
74
|
+
|
|
75
|
+
def _add_commands(self) -> None:
|
|
76
|
+
self.command_executor.add_command(
|
|
77
|
+
Command.GET_PERFORMANCE_DATA,
|
|
78
|
+
'POST',
|
|
79
|
+
'/session/$sessionId/appium/getPerformanceData',
|
|
80
|
+
)
|
|
81
|
+
self.command_executor.add_command(
|
|
82
|
+
Command.GET_PERFORMANCE_DATA_TYPES,
|
|
83
|
+
'POST',
|
|
84
|
+
'/session/$sessionId/appium/performanceData/types',
|
|
85
|
+
)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from selenium.common.exceptions import UnknownMethodException
|
|
16
|
+
from typing_extensions import Self
|
|
17
|
+
|
|
18
|
+
from appium.protocols.webdriver.can_execute_commands import CanExecuteCommands
|
|
19
|
+
from appium.protocols.webdriver.can_execute_scripts import CanExecuteScripts
|
|
20
|
+
from appium.protocols.webdriver.can_remember_extension_presence import CanRememberExtensionPresence
|
|
21
|
+
from appium.webdriver.mobilecommand import MobileCommand as Command
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Power(CanExecuteCommands, CanExecuteScripts, CanRememberExtensionPresence):
|
|
25
|
+
AC_OFF, AC_ON = 'off', 'on'
|
|
26
|
+
|
|
27
|
+
def set_power_capacity(self, percent: int) -> Self:
|
|
28
|
+
"""Emulate power capacity change on the connected emulator.
|
|
29
|
+
|
|
30
|
+
Android only.
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
percent: The power capacity to be set. Can be set from 0 to 100
|
|
34
|
+
|
|
35
|
+
Usage:
|
|
36
|
+
self.driver.set_power_capacity(50)
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
Union['WebDriver', 'Power']: Self instance
|
|
40
|
+
"""
|
|
41
|
+
ext_name = 'mobile: powerCapacity'
|
|
42
|
+
args = {'percent': percent}
|
|
43
|
+
try:
|
|
44
|
+
self.assert_extension_exists(ext_name).execute_script(ext_name, args)
|
|
45
|
+
except UnknownMethodException:
|
|
46
|
+
# TODO: Remove the fallback
|
|
47
|
+
self.mark_extension_absence(ext_name).execute(Command.SET_POWER_CAPACITY, args)
|
|
48
|
+
return self
|
|
49
|
+
|
|
50
|
+
def set_power_ac(self, ac_state: str) -> Self:
|
|
51
|
+
"""Emulate power state change on the connected emulator.
|
|
52
|
+
|
|
53
|
+
Android only.
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
ac_state: The power ac state to be set. Use `Power.AC_OFF`, `Power.AC_ON`
|
|
57
|
+
|
|
58
|
+
Usage:
|
|
59
|
+
| self.driver.set_power_ac(Power.AC_OFF)
|
|
60
|
+
| self.driver.set_power_ac(Power.AC_ON)
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
Union['WebDriver', 'Power']: Self instance
|
|
64
|
+
"""
|
|
65
|
+
ext_name = 'mobile: powerAC'
|
|
66
|
+
args = {'state': ac_state}
|
|
67
|
+
try:
|
|
68
|
+
self.assert_extension_exists(ext_name).execute_script(ext_name, args)
|
|
69
|
+
except UnknownMethodException:
|
|
70
|
+
# TODO: Remove the fallback
|
|
71
|
+
self.mark_extension_absence(ext_name).execute(Command.SET_POWER_AC, args)
|
|
72
|
+
return self
|
|
73
|
+
|
|
74
|
+
def _add_commands(self) -> None:
|
|
75
|
+
self.command_executor.add_command(
|
|
76
|
+
Command.SET_POWER_CAPACITY,
|
|
77
|
+
'POST',
|
|
78
|
+
'/session/$sessionId/appium/device/power_capacity',
|
|
79
|
+
)
|
|
80
|
+
self.command_executor.add_command(Command.SET_POWER_AC, 'POST', '/session/$sessionId/appium/device/power_ac')
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from selenium.common.exceptions import UnknownMethodException
|
|
16
|
+
from typing_extensions import Self
|
|
17
|
+
|
|
18
|
+
from appium.protocols.webdriver.can_execute_commands import CanExecuteCommands
|
|
19
|
+
from appium.protocols.webdriver.can_execute_scripts import CanExecuteScripts
|
|
20
|
+
from appium.protocols.webdriver.can_remember_extension_presence import CanRememberExtensionPresence
|
|
21
|
+
from appium.webdriver.mobilecommand import MobileCommand as Command
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Sms(CanExecuteCommands, CanExecuteScripts, CanRememberExtensionPresence):
|
|
25
|
+
def send_sms(self, phone_number: str, message: str) -> Self:
|
|
26
|
+
"""Emulate send SMS event on the connected emulator.
|
|
27
|
+
|
|
28
|
+
Android only.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
phone_number: The phone number of message sender
|
|
32
|
+
message: The message to send
|
|
33
|
+
|
|
34
|
+
Usage:
|
|
35
|
+
self.driver.send_sms('555-123-4567', 'Hey lol')
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
Union['WebDriver', 'Sms']: Self instance
|
|
39
|
+
"""
|
|
40
|
+
ext_name = 'mobile: sendSms'
|
|
41
|
+
args = {'phoneNumber': phone_number, 'message': message}
|
|
42
|
+
try:
|
|
43
|
+
self.assert_extension_exists(ext_name).execute_script(ext_name, args)
|
|
44
|
+
except UnknownMethodException:
|
|
45
|
+
# TODO: Remove the fallback
|
|
46
|
+
self.mark_extension_absence(ext_name).execute(Command.SEND_SMS, args)
|
|
47
|
+
return self
|
|
48
|
+
|
|
49
|
+
def _add_commands(self) -> None:
|
|
50
|
+
self.command_executor.add_command(Command.SEND_SMS, 'POST', '/session/$sessionId/appium/device/send_sms')
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from typing import Dict, Union
|
|
16
|
+
|
|
17
|
+
from selenium.common.exceptions import UnknownMethodException
|
|
18
|
+
|
|
19
|
+
from appium.protocols.webdriver.can_execute_commands import CanExecuteCommands
|
|
20
|
+
from appium.protocols.webdriver.can_execute_scripts import CanExecuteScripts
|
|
21
|
+
from appium.protocols.webdriver.can_remember_extension_presence import CanRememberExtensionPresence
|
|
22
|
+
from appium.webdriver.mobilecommand import MobileCommand as Command
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class SystemBars(CanExecuteCommands, CanExecuteScripts, CanRememberExtensionPresence):
|
|
26
|
+
def get_system_bars(self) -> Dict[str, Dict[str, Union[int, bool]]]:
|
|
27
|
+
"""Retrieve visibility and bounds information of the status and navigation bars.
|
|
28
|
+
|
|
29
|
+
Android only.
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
A dictionary whose keys are
|
|
33
|
+
- statusBar
|
|
34
|
+
- visible
|
|
35
|
+
- x
|
|
36
|
+
- y
|
|
37
|
+
- width
|
|
38
|
+
- height
|
|
39
|
+
- navigationBar
|
|
40
|
+
- visible
|
|
41
|
+
- x
|
|
42
|
+
- y
|
|
43
|
+
- width
|
|
44
|
+
- height
|
|
45
|
+
"""
|
|
46
|
+
ext_name = 'mobile: getSystemBars'
|
|
47
|
+
try:
|
|
48
|
+
return self.assert_extension_exists(ext_name).execute_script(ext_name)
|
|
49
|
+
except UnknownMethodException:
|
|
50
|
+
# TODO: Remove the fallback
|
|
51
|
+
return self.mark_extension_absence(ext_name).execute(Command.GET_SYSTEM_BARS)['value']
|
|
52
|
+
|
|
53
|
+
def _add_commands(self) -> None:
|
|
54
|
+
self.command_executor.add_command(
|
|
55
|
+
Command.GET_SYSTEM_BARS,
|
|
56
|
+
'GET',
|
|
57
|
+
'/session/$sessionId/appium/device/system_bars',
|
|
58
|
+
)
|