selenium常用API
定位元素:
find_element_by_id()
find_element_by_name()
find_element_by_class_name()
find_element_by_tag_name()
find_element_by_link_text()
find_element_by_partial_link_text()
find_element_by_xpath()
find_element_by_css_selector()
元素操作方式:
ele.clear()
ele.send_keys()
ele.click()
ele.submit()
xpath表達式:
滑鼠事件:
from selenium.webdriver.common.action_chains import ActionChains
ActionChains(driver) : 用于生成模拟使用者行為
perform():執行存儲行為
動作:
組合使用:
ActionChains(driver).move_to_element(ele).perform()
鍵盤事件:
from selenium.webdriver.common.keys import Keys
selenium中的等待方法:
import time
time.sleep()
implicitly_wait()
from selenium.webdriver.support.ui import WebDriverWait
對話框事件: