Sha256: 8bdce8670d513ea6b5daf25d17508a9411b4728c24bc45b85d4530db2fdd0c77
Contents?: true
Size: 1.16 KB
Versions: 5
Compression:
Stored size: 1.16 KB
Contents
# encoding: utf-8 if $os == :ios # iOS only # Tap the alert button identified by value. # @param value [Integer, String] either an integer index of the button or the button's name # @return [void] def alert_click value $driver.execute_script "UIATarget.localTarget().frontMostApp().alert().buttons()[#{value}].tap();" end # Get the alert message text. # @return [String] def alert_text $driver.switch_to.alert.text end # Accept the alert. # @return [void] def alert_accept $driver.switch_to.alert.accept end # Get the text of the alert's accept button. # The last button is considered "accept." # @return [String] def alert_accept_text a = $driver.find_element(:tag_name, :alert) return if a.nil? b = a.find_elements(:tag_name, :button) b.last.text if b && b.size >= 1 end # Dismiss the alert. # @return [void] def alert_dismiss $driver.switch_to.alert.dismiss end # Get the text of the alert's dismiss button. # The first button is considered "dismiss." # @return [String] def alert_dismiss_text a = $driver.find_element(:tag_name, :alert) return if a.nil? b = a.find_elements(:tag_name, :button) b.first.text if b && b.size >= 1 end end # if $os == :ios
Version data entries
5 entries across 5 versions & 1 rubygems