Home > other >  Scroll_from_element unable to slide a calendar
Scroll_from_element unable to slide a calendar

Time:11-12

Recently in selenium, and look at the worm is written "Selenium3 test automation of actual combat, based on the Python language", learn sliding calendar here is in trouble, baidu a circle, also didn't find a solution, free of classmates help me to look at, very grateful,
Mobile phone simulation Settings and disable the w3 standards, are set up, was not an error code to run and slide does not perform the operation, also
Specific code is as follows:
 
From the time the import sleep
The from the selenium import webdriver
The from the selenium. Webdriver import TouchActions

Opt=webdriver. ChromeOptions ()
Opt. Add_experimental_option (w3c, False)
MobileEmulation={' deviceName ':' the Galaxy S5}
Opt. Add_experimental_option (' mobileEmulation mobileEmulation)
Driver=webdriver. Chrome (options=opt)
Driver. The get (" https://www.jq22.com/yanshi4976 ")
Driver. Maximize_window ()
Sleep (2)
Driver. Switch_to. Frame (' iframe)
# sleep10 seconds, manual closing the advertising
Sleep (10)
# click date input box
Driver. Find_element_by_id (' appDate). Click ()
Slide # positioning to year, month, day
The date=driver. Find_elements_by_class_name (" dwwo ")
Year=date [0]
The month=date [1]
Day=date [2]

Action=TouchActions (driver)
Action. Scroll_from_element (year, 0, 50). The perform ()
Action=TouchActions (driver)
Action. Scroll_from_element (month, 0, 50). The perform ()
Action=TouchActions (driver)
Action. Scroll_from_element (day 0, 50). The perform ()
# driver. The quit ()
  • Related