Iframe and action processing

from selenium import webdriver 
from time import sleep #Import the
corresponding class of action chain
from selenium.webdriver import ActionChains
bro = webdriver.Chrome (executable_path = '. / chromedriver')

bro.get ('https://www.runoob.com/ try / try.php? filename = jqueryui-api-droppable ') #If the

positioned tag is in the iframe tag, you must perform tag positioning through the following operations
bro.switch_to.frame (' iframeResult ') # Switch browsing The scope of the device tag positioning
div = bro.find_element_by_id ('draggable') #Action

chain
action = ActionChains (bro) #click and hold the
specified label
action.click_and_hold (div)

for i in range (5):
#perform () Immediately execute the action chain operation
#move_by_offset (x, y): x horizontal direction y vertical direction
action.move_by_offset (17,0) .perform ()
sleep (0.5) #release

action chain
action.release ()

bro.quit()

Guess you like

Origin www.cnblogs.com/huahuawang/p/12692946.html