内部函数
'_addCommands',
'_file_detector',
'_is_remote',
'_mobile',
'_switch_to',
'_unwrap_value',
'_web_element_cls',
'_wrap_value',
'activate_ime_engine',
'active_ime_engine',
'add_cookie',
'app_strings',
'application_cache',
'available_ime_engines',
'back',
'background_app',
'capabilities',
'close',
关闭应用
close_app
'command_executor',
'context',
'contexts',
'create_web_element',
'current_activity',
'current_context',
'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',
'execute',
'execute_async_script',
'execute_script',
'file_detector',
'file_detector_context',
查找元素
'find_element',
'find_element_by_accessibility_id',
'find_element_by_android_uiautomator',
'find_element_by_class_name',
'find_element_by_css_selector',
'find_element_by_id',
'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_xpath',
'find_elements',
'find_elements_by_accessibility_id',
'find_elements_by_android_uiautomator',
'find_elements_by_class_name',
'find_elements_by_css_selector',
'find_elements_by_id',
'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_xpath',
'flick',
'forward',
'get',
'get_cookie',
'get_cookies',
获取日志
get_log
get_log(log_type) method of appium.webdriver.webdriver.WebDriver instance
Gets the log for a given log type
:Args:
- log_type: type of log that which will be returned
:Usage:
driver.get_log('browser')
driver.get_log('driver')
driver.get_log('client')
driver.get_log('server')
Supported types : {
"syslog"
:
"System Logs - Device logs for iOS applications on real devices and simulators"
,
"crashlog"
:
"Crash Logs - Crash reports for iOS applications on real devices and simulators"
,
"performance"
:
"Performance Logs - Debug Timelines on real devices and simulators"
}
|
截图
get_screenshot_as_base64
Gets the screenshot of the current window as a base64 encoded string
which is useful in embedded images in HTML.
:Usage:
driver.get_screenshot_as_base64()
get_screenshot_as_file
get_screenshot_as_file(filename) method of appium.webdriver.webdriver.WebDriver instance
Gets the screenshot of the current window. Returns False if there is
any IOError, else returns True. Use full paths in your filename.
:Args:
- filename: The full path you wish to save your screenshot to.
:Usage:
driver.get_screenshot_as_file('/Screenshots/foo.png')
get_screenshot_as_png
get_screenshot_as_png() method of appium.webdriver.webdriver.WebDriver instance
Gets the screenshot of the current window as a binary data.
:Usage:
driver.get_screenshot_as_png()
'get_settings',
'get_window_position',
'get_window_size',
'hide_keyboard',
'implicitly_wait',
'install_app',
'is_app_installed',
'is_ime_active',
'keyevent',
'launch_app',
'lock',
'log_types',
'long_press_keycode',
'maximize_window',
'mobile',
'name',
'network_connection',
'open_notifications',
'orientation',
获取UI树信息
page_source
'pinch',
'press_keycode',
'pull_file',
'pull_folder',
'push_file',
'quit',
'refresh',
'remove_app',
'reset',
'save_screenshot',
'scroll',
'session_id',
'set_location',
'set_network_connection',
'set_page_load_timeout',
'set_script_timeout',
'set_value',
'set_window_position',
'set_window_size',
'shake',
'start_activity',
'start_client',
'start_session',
'stop_client',
'swipe',
'switch_to',
'switch_to_active_element',
'switch_to_alert',
'switch_to_default_content',
'switch_to_frame',
'switch_to_window',
'tap',
'title',
'toggle_location_services',
'touch_id',
'update_settings',
'w3c',
'wait_activity',
'window_handles',
'zoom'

这篇博客详细介绍了如何使用Python的WebDriverAPI进行各种操作,包括内部函数、关闭应用、查找元素、获取日志、截图和获取UI树信息等。内容涵盖了从基本的页面导航到复杂的元素交互,如拖放、滚动、点击等,还涉及到IME引擎的激活和关闭,以及日志获取和截图功能,是Python自动化测试的重要参考资料。
400

被折叠的 条评论
为什么被折叠?



