selenium中的alter弹框

from selenium import webdriver
import time
driver=webdriver.Chrome()
driver.get('http://ui.imdsx.cn/uitester/')
# 最大化浏览器
driver.maximize_window()
# 定位到页面顶部
js='window.scrollTo(0,0)'
driver.execute_script(js)
time.sleep(2)
driver.find_element_by_css_selector('#onC').click()
time.sleep(2)
driver.switch_to.alert.accept()
time.sleep(2)
driver.find_element_by_css_selector('#confirm').click()
time.sleep(2)
# driver.switch_to.alert.accept()点击确认按钮
# 点击取消按钮
driver.switch_to.alert.dismiss()
time.sleep(2) element= driver.find_element_by_css_selector('#dbonC')
from selenium.webdriver import ActionChains
# 模拟鼠标双击
action_chain=ActionChains(driver)
action_chain.double_click(element).perform()
time.sleep(2)
# 点击确认按钮
driver.switch_to.alert.accept()
time.sleep(2) # 模拟鼠标右击
element=driver.find_element_by_css_selector('#menuOnC')
action_chain=ActionChains(driver)
action_chain.context_click(element).perform()
time.sleep(2)
driver.switch_to.alert.accept()
time.sleep(2) # 鼠标悬浮的连贯操作
xf=driver.find_element_by_css_selector('#a')
time.sleep(2)
disinput=driver.find_element_by_css_selector('#dis1')
# perform执行操作
ActionChains(driver).move_to_element(xf).click(disinput).perform()
time.sleep(2)
driver.switch_to.alert.accept()
time.sleep(2)
上一篇:BZOJ 1976 能量魔方 Cube(最小割)


下一篇:2013移动APP界面设计趋势与设计理念