Untitled
unknown
plain_text
2 years ago
2.7 kB
7
Indexable
def toggle_subtitles_two_fingers(self):
# Get the size of the screen
window_size = self.driver.get_window_size()
# Define the coordinates for two fingers
finger1 = {'x': window_size['width'] * 0.2, 'y': window_size['height'] * 0.5}
finger2 = {'x': window_size['width'] * 0.3, 'y': window_size['height'] * 0.6}
# Perform a double tap with two fingers
action = TouchAction(self.driver)
action.tap(x=finger1['x'], y=finger1['y'], count=2).wait(10).perform()
action.tap(x=finger2['x'], y=finger2['y'], count=2).perform()
action.perform()
self.wait()
print("toggle_subtitles_two_fingers - android_player_page")
logging.info("toggle_subtitles_two_fingers - android_player_page")
# # Coordinates for the second finger
# x_coordinate = 183
# y_coordinate = 265
#
# # TouchAction for the first finger
# first_finger = TouchAction()
# first_finger.tap(x=x_coordinate, y=y_coordinate, count=2).wait(100) # Adjust the coordinates as needed
#
# second_finger = TouchAction()
# second_finger.tap(x=x_coordinate + 10, y=y_coordinate + 10, count=2).wait(100)
#
# # Create a MultiAction and add both TouchActions
# double_tap = MultiAction(self.driver)
# double_tap.add(first_finger, second_finger)
#
# double_tap2 = MultiAction(self.driver)
# double_tap2.add(first_finger, second_finger)
#
# # Perform the double-tap
# double_tap2.perform()
# double_tap.perform()
#
# double_tap.perform() # delete
# self.driver.tap([[183, 265], [193, 275]])
# self.driver.tap([[183, 265], [193, 275]])
# self.wait() # delete
# Coordinates for the second finger
# x_coordinate = 183
# y_coordinate = 265
#
# # TouchAction for the first finger
# first_finger = TouchAction(self.driver)
# first_finger.tap(x=x_coordinate, y=y_coordinate).wait(100).release()
#
# # TouchAction for the second finger
# second_finger = TouchAction(self.driver)
# second_finger.tap(x=x_coordinate + 10, y=y_coordinate + 10).wait(100).release()
#
# # Create a MultiAction and add both TouchActions
# double_tap = MultiAction(self.driver)
# double_tap.add(first_finger, second_finger)
#
# # Perform the double-tap
# double_tap.perform()
#
# def double_click_element(self, by, value):
# logger.step_normal("Element [%s]: DoubleClick()" % value)
#
# # Wait for the element to be clickable
# element = WebDriverWait(self.driver, 10).until(
# EC.element_to_be_clickable((by, value))
# )
#
# # Double-click the element
# action = TouchAction(self.driver)
# action.double_click(element)
# action.perform()Editor is loading...
Leave a Comment