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,13 @@
|
|
|
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.
|
|
@@ -0,0 +1,188 @@
|
|
|
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 TYPE_CHECKING, List, Optional, Tuple, cast
|
|
16
|
+
|
|
17
|
+
from selenium.webdriver.common.action_chains import ActionChains
|
|
18
|
+
from selenium.webdriver.common.actions import interaction
|
|
19
|
+
from selenium.webdriver.common.actions.action_builder import ActionBuilder
|
|
20
|
+
from selenium.webdriver.common.actions.mouse_button import MouseButton
|
|
21
|
+
from selenium.webdriver.common.actions.pointer_input import PointerInput
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
from appium.webdriver.webelement import WebElement
|
|
25
|
+
|
|
26
|
+
if TYPE_CHECKING:
|
|
27
|
+
# noinspection PyUnresolvedReferences
|
|
28
|
+
from appium.webdriver.webdriver import WebDriver
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class ActionHelpers:
|
|
32
|
+
def scroll(self, origin_el: WebElement, destination_el: WebElement, duration: Optional[int] = None) -> Self:
|
|
33
|
+
"""Scrolls from one element to another
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
origin_el: the element from which to begin scrolling (center of element)
|
|
37
|
+
destination_el: the element to scroll to (center of element)
|
|
38
|
+
duration: defines speed of scroll action when moving from originalEl to destinationEl.
|
|
39
|
+
Default is 600 ms for W3C spec.
|
|
40
|
+
|
|
41
|
+
Usage:
|
|
42
|
+
driver.scroll(el1, el2)
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
Union['WebDriver', 'ActionHelpers']: Self instance
|
|
46
|
+
"""
|
|
47
|
+
# XCUITest x W3C spec has no duration by default in server side
|
|
48
|
+
if duration is None:
|
|
49
|
+
duration = 600
|
|
50
|
+
|
|
51
|
+
touch_input = PointerInput(interaction.POINTER_TOUCH, 'touch')
|
|
52
|
+
|
|
53
|
+
actions = ActionChains(cast('WebDriver', self))
|
|
54
|
+
actions.w3c_actions = ActionBuilder(self, mouse=touch_input)
|
|
55
|
+
|
|
56
|
+
# https://github.com/SeleniumHQ/selenium/blob/3c82c868d4f2a7600223a1b3817301d0b04d28e4/py/selenium/webdriver/common/actions/pointer_actions.py#L83
|
|
57
|
+
actions.w3c_actions.pointer_action.move_to(origin_el)
|
|
58
|
+
actions.w3c_actions.pointer_action.pointer_down()
|
|
59
|
+
# setup duration for second move only, assuming duration always has atleast default value
|
|
60
|
+
actions.w3c_actions = ActionBuilder(self, mouse=touch_input, duration=duration)
|
|
61
|
+
actions.w3c_actions.pointer_action.move_to(destination_el)
|
|
62
|
+
actions.w3c_actions.pointer_action.release()
|
|
63
|
+
actions.perform()
|
|
64
|
+
return self
|
|
65
|
+
|
|
66
|
+
def drag_and_drop(self, origin_el: WebElement, destination_el: WebElement, pause: Optional[float] = None) -> Self:
|
|
67
|
+
"""Drag the origin element to the destination element
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
origin_el: the element to drag
|
|
71
|
+
destination_el: the element to drag to
|
|
72
|
+
pause: how long the action pauses before moving after the tap and hold, in float seconds.
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
Union['WebDriver', 'ActionHelpers']: Self instance
|
|
76
|
+
"""
|
|
77
|
+
actions = ActionChains(cast('WebDriver', self))
|
|
78
|
+
# 'mouse' pointer action
|
|
79
|
+
actions.w3c_actions.pointer_action.click_and_hold(origin_el)
|
|
80
|
+
if pause is not None and pause > 0:
|
|
81
|
+
actions.w3c_actions.pointer_action.pause(pause)
|
|
82
|
+
actions.w3c_actions.pointer_action.move_to(destination_el)
|
|
83
|
+
actions.w3c_actions.pointer_action.release()
|
|
84
|
+
actions.perform()
|
|
85
|
+
return self
|
|
86
|
+
|
|
87
|
+
def tap(self, positions: List[Tuple[int, int]], duration: Optional[int] = None) -> Self:
|
|
88
|
+
"""Taps on an particular place with up to five fingers, holding for a
|
|
89
|
+
certain time
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
positions: an array of tuples representing the x/y coordinates of
|
|
93
|
+
the fingers to tap. Length can be up to five.
|
|
94
|
+
duration: length of time to tap, in ms
|
|
95
|
+
|
|
96
|
+
Usage:
|
|
97
|
+
driver.tap([(100, 20), (100, 60), (100, 100)], 500)
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
Union['WebDriver', 'ActionHelpers']: Self instance
|
|
101
|
+
"""
|
|
102
|
+
if len(positions) == 1:
|
|
103
|
+
actions = ActionChains(cast('WebDriver', self))
|
|
104
|
+
actions.w3c_actions = ActionBuilder(self, mouse=PointerInput(interaction.POINTER_TOUCH, 'touch'))
|
|
105
|
+
x = positions[0][0]
|
|
106
|
+
y = positions[0][1]
|
|
107
|
+
actions.w3c_actions.pointer_action.move_to_location(x, y)
|
|
108
|
+
actions.w3c_actions.pointer_action.pointer_down()
|
|
109
|
+
if duration:
|
|
110
|
+
actions.w3c_actions.pointer_action.pause(duration / 1000)
|
|
111
|
+
else:
|
|
112
|
+
actions.w3c_actions.pointer_action.pause(0.1)
|
|
113
|
+
actions.w3c_actions.pointer_action.release()
|
|
114
|
+
actions.perform()
|
|
115
|
+
else:
|
|
116
|
+
finger = 0
|
|
117
|
+
actions = ActionChains(cast('WebDriver', self))
|
|
118
|
+
actions.w3c_actions.devices = []
|
|
119
|
+
|
|
120
|
+
for position in positions:
|
|
121
|
+
finger += 1
|
|
122
|
+
x = position[0]
|
|
123
|
+
y = position[1]
|
|
124
|
+
|
|
125
|
+
# https://github.com/SeleniumHQ/selenium/blob/trunk/py/selenium/webdriver/common/actions/pointer_input.py
|
|
126
|
+
new_input = actions.w3c_actions.add_pointer_input('touch', f'finger{finger}')
|
|
127
|
+
new_input.create_pointer_move(x=x, y=y)
|
|
128
|
+
new_input.create_pointer_down(button=MouseButton.LEFT)
|
|
129
|
+
if duration:
|
|
130
|
+
new_input.create_pause(duration / 1000)
|
|
131
|
+
else:
|
|
132
|
+
new_input.create_pause(0.1)
|
|
133
|
+
new_input.create_pointer_up(MouseButton.LEFT)
|
|
134
|
+
actions.perform()
|
|
135
|
+
return self
|
|
136
|
+
|
|
137
|
+
def swipe(self, start_x: int, start_y: int, end_x: int, end_y: int, duration: int = 0) -> Self:
|
|
138
|
+
"""Swipe from one point to another point, for an optional duration.
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
start_x: x-coordinate at which to start
|
|
142
|
+
start_y: y-coordinate at which to start
|
|
143
|
+
end_x: x-coordinate at which to stop
|
|
144
|
+
end_y: y-coordinate at which to stop
|
|
145
|
+
duration: defines the swipe speed as time taken to swipe from point a to point b, in ms.
|
|
146
|
+
|
|
147
|
+
Usage:
|
|
148
|
+
driver.swipe(100, 100, 100, 400)
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
Union['WebDriver', 'ActionHelpers']: Self instance
|
|
152
|
+
"""
|
|
153
|
+
touch_input = PointerInput(interaction.POINTER_TOUCH, 'touch')
|
|
154
|
+
|
|
155
|
+
actions = ActionChains(cast('WebDriver', self))
|
|
156
|
+
actions.w3c_actions = ActionBuilder(self, mouse=touch_input)
|
|
157
|
+
actions.w3c_actions.pointer_action.move_to_location(start_x, start_y)
|
|
158
|
+
actions.w3c_actions.pointer_action.pointer_down()
|
|
159
|
+
if duration > 0:
|
|
160
|
+
actions.w3c_actions = ActionBuilder(self, mouse=touch_input, duration=duration)
|
|
161
|
+
actions.w3c_actions.pointer_action.move_to_location(end_x, end_y)
|
|
162
|
+
actions.w3c_actions.pointer_action.release()
|
|
163
|
+
actions.perform()
|
|
164
|
+
return self
|
|
165
|
+
|
|
166
|
+
def flick(self, start_x: int, start_y: int, end_x: int, end_y: int) -> Self:
|
|
167
|
+
"""Flick from one point to another point.
|
|
168
|
+
|
|
169
|
+
Args:
|
|
170
|
+
start_x: x-coordinate at which to start
|
|
171
|
+
start_y: y-coordinate at which to start
|
|
172
|
+
end_x: x-coordinate at which to stop
|
|
173
|
+
end_y: y-coordinate at which to stop
|
|
174
|
+
|
|
175
|
+
Usage:
|
|
176
|
+
driver.flick(100, 100, 100, 400)
|
|
177
|
+
|
|
178
|
+
Returns:
|
|
179
|
+
Union['WebDriver', 'ActionHelpers']: Self instance
|
|
180
|
+
"""
|
|
181
|
+
actions = ActionChains(cast('WebDriver', self))
|
|
182
|
+
actions.w3c_actions = ActionBuilder(self, mouse=PointerInput(interaction.POINTER_TOUCH, 'touch'))
|
|
183
|
+
actions.w3c_actions.pointer_action.move_to_location(start_x, start_y)
|
|
184
|
+
actions.w3c_actions.pointer_action.pointer_down()
|
|
185
|
+
actions.w3c_actions.pointer_action.move_to_location(end_x, end_y)
|
|
186
|
+
actions.w3c_actions.pointer_action.release()
|
|
187
|
+
actions.perform()
|
|
188
|
+
return self
|
|
File without changes
|
|
@@ -0,0 +1,65 @@
|
|
|
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 TimeoutException, UnknownMethodException
|
|
16
|
+
from selenium.webdriver.support.ui import WebDriverWait
|
|
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 Activities(CanExecuteCommands, CanExecuteScripts, CanRememberExtensionPresence):
|
|
25
|
+
@property
|
|
26
|
+
def current_activity(self) -> str:
|
|
27
|
+
"""Retrieves the current activity running on the device.
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
str: The current activity name running on the device
|
|
31
|
+
"""
|
|
32
|
+
ext_name = 'mobile: getCurrentActivity'
|
|
33
|
+
try:
|
|
34
|
+
return self.assert_extension_exists(ext_name).execute_script(ext_name)
|
|
35
|
+
except UnknownMethodException:
|
|
36
|
+
# TODO: Remove the fallback
|
|
37
|
+
return self.mark_extension_absence(ext_name).execute(Command.GET_CURRENT_ACTIVITY)['value']
|
|
38
|
+
|
|
39
|
+
def wait_activity(self, activity: str, timeout: int, interval: int = 1) -> bool:
|
|
40
|
+
"""Wait for an activity: block until target activity presents or time out.
|
|
41
|
+
|
|
42
|
+
This is an Android-only method.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
activity: target activity
|
|
46
|
+
timeout: max wait time, in seconds
|
|
47
|
+
interval: sleep interval between retries, in seconds
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
`True` if the target activity is shown
|
|
51
|
+
"""
|
|
52
|
+
try:
|
|
53
|
+
WebDriverWait(self, timeout, interval).until( # type: ignore[type-var]
|
|
54
|
+
lambda d: d.current_activity == activity
|
|
55
|
+
)
|
|
56
|
+
return True
|
|
57
|
+
except TimeoutException:
|
|
58
|
+
return False
|
|
59
|
+
|
|
60
|
+
def _add_commands(self) -> None:
|
|
61
|
+
self.command_executor.add_command(
|
|
62
|
+
Command.GET_CURRENT_ACTIVITY,
|
|
63
|
+
'GET',
|
|
64
|
+
'/session/$sessionId/appium/device/current_activity',
|
|
65
|
+
)
|
|
@@ -0,0 +1,59 @@
|
|
|
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 Common(CanExecuteCommands, CanExecuteScripts, CanRememberExtensionPresence):
|
|
25
|
+
def open_notifications(self) -> Self:
|
|
26
|
+
"""Open notification shade in Android (API Level 18 and above)
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
Union['WebDriver', 'Common']: Self instance
|
|
30
|
+
"""
|
|
31
|
+
ext_name = 'mobile: openNotifications'
|
|
32
|
+
try:
|
|
33
|
+
self.assert_extension_exists(ext_name).execute_script(ext_name)
|
|
34
|
+
except UnknownMethodException:
|
|
35
|
+
# TODO: Remove the fallback
|
|
36
|
+
self.mark_extension_absence(ext_name).execute(Command.OPEN_NOTIFICATIONS, {})
|
|
37
|
+
return self
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def current_package(self) -> str:
|
|
41
|
+
"""Retrieves the current package running on the device."""
|
|
42
|
+
ext_name = 'mobile: getCurrentPackage'
|
|
43
|
+
try:
|
|
44
|
+
return self.assert_extension_exists(ext_name).execute_script(ext_name)
|
|
45
|
+
except UnknownMethodException:
|
|
46
|
+
# TODO: Remove the fallback
|
|
47
|
+
return self.mark_extension_absence(ext_name).execute(Command.GET_CURRENT_PACKAGE)['value']
|
|
48
|
+
|
|
49
|
+
def _add_commands(self) -> None:
|
|
50
|
+
self.command_executor.add_command(
|
|
51
|
+
Command.GET_CURRENT_PACKAGE,
|
|
52
|
+
'GET',
|
|
53
|
+
'/session/$sessionId/appium/device/current_package',
|
|
54
|
+
)
|
|
55
|
+
self.command_executor.add_command(
|
|
56
|
+
Command.OPEN_NOTIFICATIONS,
|
|
57
|
+
'POST',
|
|
58
|
+
'/session/$sessionId/appium/device/open_notifications',
|
|
59
|
+
)
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
|
|
17
|
+
from appium.protocols.webdriver.can_execute_commands import CanExecuteCommands
|
|
18
|
+
from appium.protocols.webdriver.can_execute_scripts import CanExecuteScripts
|
|
19
|
+
from appium.protocols.webdriver.can_remember_extension_presence import CanRememberExtensionPresence
|
|
20
|
+
from appium.webdriver.mobilecommand import MobileCommand as Command
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Display(CanExecuteCommands, CanExecuteScripts, CanRememberExtensionPresence):
|
|
24
|
+
def get_display_density(self) -> int:
|
|
25
|
+
"""Get the display density, Android only
|
|
26
|
+
|
|
27
|
+
Returns:
|
|
28
|
+
The display density of the Android device(dpi)
|
|
29
|
+
|
|
30
|
+
Usage:
|
|
31
|
+
self.driver.get_display_density()
|
|
32
|
+
|
|
33
|
+
Return:
|
|
34
|
+
int: The display density
|
|
35
|
+
"""
|
|
36
|
+
ext_name = 'mobile: getDisplayDensity'
|
|
37
|
+
try:
|
|
38
|
+
return self.assert_extension_exists(ext_name).execute_script(ext_name)
|
|
39
|
+
except UnknownMethodException:
|
|
40
|
+
# TODO: Remove the fallback
|
|
41
|
+
return self.mark_extension_absence(ext_name).execute(Command.GET_DISPLAY_DENSITY)['value']
|
|
42
|
+
|
|
43
|
+
def _add_commands(self) -> None:
|
|
44
|
+
self.command_executor.add_command(
|
|
45
|
+
Command.GET_DISPLAY_DENSITY,
|
|
46
|
+
'GET',
|
|
47
|
+
'/session/$sessionId/appium/device/display_density',
|
|
48
|
+
)
|
|
@@ -0,0 +1,147 @@
|
|
|
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 GsmCallActions:
|
|
27
|
+
CALL = 'call'
|
|
28
|
+
ACCEPT = 'accept'
|
|
29
|
+
CANCEL = 'cancel'
|
|
30
|
+
HOLD = 'hold'
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class GsmSignalStrength:
|
|
34
|
+
NONE_OR_UNKNOWN = 0
|
|
35
|
+
POOR = 1
|
|
36
|
+
MODERATE = 2
|
|
37
|
+
GOOD = 3
|
|
38
|
+
GREAT = 4
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class GsmVoiceState:
|
|
42
|
+
UNREGISTERED = 'unregistered'
|
|
43
|
+
HOME = 'home'
|
|
44
|
+
ROAMING = 'roaming'
|
|
45
|
+
SEARCHING = 'searching'
|
|
46
|
+
DENIED = 'denied'
|
|
47
|
+
OFF = 'off'
|
|
48
|
+
ON = 'on'
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class Gsm(CanExecuteCommands, CanExecuteScripts, CanRememberExtensionPresence):
|
|
52
|
+
def make_gsm_call(self, phone_number: str, action: str) -> Self:
|
|
53
|
+
"""Make GSM call (Emulator only)
|
|
54
|
+
|
|
55
|
+
Android only.
|
|
56
|
+
|
|
57
|
+
Args:
|
|
58
|
+
phone_number: The phone number to call to.
|
|
59
|
+
action: The call action.
|
|
60
|
+
A member of the const `appium.webdriver.extensions.android.gsm.GsmCallActions`
|
|
61
|
+
|
|
62
|
+
Usage:
|
|
63
|
+
self.driver.make_gsm_call('5551234567', GsmCallActions.CALL)
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
Union['WebDriver', 'Gsm']: Self instance
|
|
67
|
+
"""
|
|
68
|
+
ext_name = 'mobile: gsmCall'
|
|
69
|
+
constants = extract_const_attributes(GsmCallActions)
|
|
70
|
+
if action not in constants.values():
|
|
71
|
+
logger.warning(
|
|
72
|
+
f'{action} is unknown. Consider using one of {list(constants.keys())} constants. '
|
|
73
|
+
f'(e.g. {GsmCallActions.__name__}.CALL)'
|
|
74
|
+
)
|
|
75
|
+
args = {'phoneNumber': phone_number, 'action': action}
|
|
76
|
+
try:
|
|
77
|
+
self.assert_extension_exists(ext_name).execute_script(ext_name, args)
|
|
78
|
+
except UnknownMethodException:
|
|
79
|
+
# TODO: Remove the fallback
|
|
80
|
+
self.mark_extension_absence(ext_name).execute(Command.MAKE_GSM_CALL, args)
|
|
81
|
+
return self
|
|
82
|
+
|
|
83
|
+
def set_gsm_signal(self, strength: int) -> Self:
|
|
84
|
+
"""Set GSM signal strength (Emulator only)
|
|
85
|
+
|
|
86
|
+
Android only.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
strength: Signal strength.
|
|
90
|
+
A member of the enum :obj:`appium.webdriver.extensions.android.gsm.GsmSignalStrength`
|
|
91
|
+
|
|
92
|
+
Usage:
|
|
93
|
+
self.driver.set_gsm_signal(GsmSignalStrength.GOOD)
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
Union['WebDriver', 'Gsm']: Self instance
|
|
97
|
+
"""
|
|
98
|
+
ext_name = 'mobile: gsmSignal'
|
|
99
|
+
constants = extract_const_attributes(GsmSignalStrength)
|
|
100
|
+
if strength not in constants.values():
|
|
101
|
+
logger.warning(
|
|
102
|
+
f'{strength} is out of range. Consider using one of {list(constants.keys())} constants. '
|
|
103
|
+
f'(e.g. {GsmSignalStrength.__name__}.GOOD)'
|
|
104
|
+
)
|
|
105
|
+
try:
|
|
106
|
+
self.assert_extension_exists(ext_name).execute_script(ext_name, {'strength': strength})
|
|
107
|
+
except UnknownMethodException:
|
|
108
|
+
# TODO: Remove the fallback
|
|
109
|
+
self.mark_extension_absence(ext_name).execute(
|
|
110
|
+
Command.SET_GSM_SIGNAL, {'signalStrength': strength, 'signalStrengh': strength}
|
|
111
|
+
)
|
|
112
|
+
return self
|
|
113
|
+
|
|
114
|
+
def set_gsm_voice(self, state: str) -> Self:
|
|
115
|
+
"""Set GSM voice state (Emulator only)
|
|
116
|
+
|
|
117
|
+
Android only.
|
|
118
|
+
|
|
119
|
+
Args:
|
|
120
|
+
state: State of GSM voice.
|
|
121
|
+
A member of the const `appium.webdriver.extensions.android.gsm.GsmVoiceState`
|
|
122
|
+
|
|
123
|
+
Usage:
|
|
124
|
+
self.driver.set_gsm_voice(GsmVoiceState.HOME)
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
Union['WebDriver', 'Gsm']: Self instance
|
|
128
|
+
"""
|
|
129
|
+
ext_name = 'mobile: gmsVoice'
|
|
130
|
+
constants = extract_const_attributes(GsmVoiceState)
|
|
131
|
+
if state not in constants.values():
|
|
132
|
+
logger.warning(
|
|
133
|
+
f'{state} is unknown. Consider using one of {list(constants.keys())} constants. '
|
|
134
|
+
f'(e.g. {GsmVoiceState.__name__}.HOME)'
|
|
135
|
+
)
|
|
136
|
+
args = {'state': state}
|
|
137
|
+
try:
|
|
138
|
+
self.assert_extension_exists(ext_name).execute_script(ext_name, args)
|
|
139
|
+
except UnknownMethodException:
|
|
140
|
+
# TODO: Remove the fallback
|
|
141
|
+
self.mark_extension_absence(ext_name).execute(Command.SET_GSM_VOICE, args)
|
|
142
|
+
return self
|
|
143
|
+
|
|
144
|
+
def _add_commands(self) -> None:
|
|
145
|
+
self.command_executor.add_command(Command.MAKE_GSM_CALL, 'POST', '/session/$sessionId/appium/device/gsm_call')
|
|
146
|
+
self.command_executor.add_command(Command.SET_GSM_SIGNAL, 'POST', '/session/$sessionId/appium/device/gsm_signal')
|
|
147
|
+
self.command_executor.add_command(Command.SET_GSM_VOICE, 'POST', '/session/$sessionId/appium/device/gsm_voice')
|