lib/appium_lib/driver.rb in appium_lib-9.8.1 vs lib/appium_lib/driver.rb in appium_lib-9.8.2
- old
+ new
@@ -280,10 +280,30 @@
# @return [Boolean]
def automation_name_is_xcuitest?
!@core.automation_name.nil? && @core.automation_name == :xcuitest
end
+ # Get the dialect value whether current driver is OSS or W3C
+ #
+ # @return [:oss | :w3c]
+ #
+ # @example
+ #
+ # if dialect == :w3c
+ # driver.action
+ # .move_to_location(500, 500).pointer_down(:left)
+ # .move_to_location(0, 700)
+ # .release.perform
+ # else
+ # action = TouchAction.new(driver).press(x: 500, y: 500).move_to(500, 700).release
+ # action.perform
+ # end
+ #
+ def dialect
+ @driver.dialect
+ end
+
# Return true if the target Appium server is over REQUIRED_VERSION_XCUITEST.
# If the Appium server is under REQUIRED_VERSION_XCUITEST, then error is raised.
# @return [Boolean]
def check_server_version_xcuitest
if automation_name_is_xcuitest? &&
@@ -393,13 +413,27 @@
# @example
#
# screenshot '/tmp/hi.png'
#
# @param png_save_path [String] the full path to save the png
- # @return [nil]
+ # @return [File]
def screenshot(png_save_path)
@driver.save_screenshot png_save_path
+ end
+
+ # Takes a png screenshot of particular element's area
+ #
+ # @example
+ #
+ # el = find_element :accessibility_id, zzz
+ # element_screenshot el, '/tmp/hi.png'
+ #
+ # @param [String] element Element take a screenshot
+ # @param [String] png_save_path the full path to save the png
+ # @return [File]
+ def element_screenshot(element, png_save_path)
+ @driver.take_element_screenshot element, png_save_path
nil
end
# Quits the driver
# @return [void]
@@ -464,11 +498,9 @@
# to be able to extend correctly.
extend_for(device: @core.device, automation_name: @core.automation_name) if automation_name.nil?
@appium_server_status = appium_server_version
check_server_version_xcuitest
-
- set_implicit_wait(@core.default_wait)
@driver
end
# To ignore error for Espresso Driver