id_#当前元素的ID tag_name#获取元素标签名的属性 text#获取该元素的文本。 click()#单击(点击)元素 submit()#提交表单 clear()#清除一个文本输入元素的文本 get_attribute(name)#获得属性值 s_selected(self)#元素是否被选择Whether the element is selected. is_enabled()#元素是否被启用 find_element_by_id(id_) find_elements_by_id(id_)#查找元素的id find_element_by_name(name) find_elements_by_name(name)#查找元素的name find_element_by_link_text(link_text) find_elements_by_link_text(link_text)#查找元素的链接文本 find_element_by_partial_link_text(link_text) find_elements_by_partial_link_text(link_text)#查找元素的链接的部分文本 find_element_by_tag_name(name) find_elements_by_tag_name(name)#查找元素的标签名 find_element_by_xpath(xpath)#查找元素的xpath find_elements_by_xpath(xpath)#查找元素内的子元素的xpath find_element_by_class_name(name)#查找一个元素的类名 find_elements_by_class_name(name)#查找元素的类名 find_element_by_css_selector(css_selector)#查找并返回一个元素的CSS 选择器 find_elements_by_css_selector(css_selector)#查找并返回多个元素的CSS 选择器列表 send_keys(*value)#模拟输入元素
window_handles #获取当前浏览器的标签页
switch_to.window() #切换到指定的标签页
switch_to.frame()#切换到指定的框架
implicitly_wait() #隐式等待,在一定时间内等待元素出现
弹窗处理
switch_to_alert()
switch_to_alert()#选择弹窗
accept() #弹窗确定
键盘模拟
NULL = u’ue000’ – CANCEL = u’ue001’ # ^break – HELP = u’ue002’ – BACK_SPACE = u’ue003’ – TAB = u’ue004’ – CLEAR = u’ue005’ – RETURN = u’ue006’ – ENTER = u’ue007’ – SHIFT = u’ue008’ – LEFT_SHIFT = u’ue008’ # alias – CONTROL = u’ue009’ – LEFT_CONTROL = u’ue009’ # alias – ALT = u’ue00a’ – LEFT_ALT = u’ue00a’ # alias – PAUSE = u’ue00b’ – ESCAPE = u’ue00c’ – SPACE = u’ue00d’ – PAGE_UP = u’ue00e’ – PAGE_DOWN = u’ue00f’ – END = u’ue010’ – HOME = u’ue011’ – LEFT = u’ue012’ – ARROW_LEFT = u’ue012’ # alias – UP = u’ue013’ – ARROW_UP = u’ue013’ # alias – RIGHT = u’ue014’ – ARROW_RIGHT = u’ue014’ # alias – DOWN = u’ue015’ – ARROW_DOWN = u’ue015’ # alias – INSERT = u’ue016’ – DELETE = u’ue017’ – SEMICOLON = u’ue018’ – EQUALS = u’ue019’ – NUMPAD0 = u’ue01a’ # numbe pad keys – NUMPAD1 = u’ue01b’ – NUMPAD2 = u’ue01c’ – NUMPAD3 = u’ue01d’ – NUMPAD4 = u’ue01e’ – NUMPAD5 = u’ue01f’ – NUMPAD6 = u’ue020’ – NUMPAD7 = u’ue021’ – NUMPAD8 = u’ue022’ – NUMPAD9 = u’ue023’ – MULTIPLY = u’ue024’ – ADD = u’ue025’ – SEPARATOR = u’ue026’ – SUBTRACT = u’ue027’ – DECIMAL = u’ue028’ – DIVIDE = u’ue029’ – F1 = u’ue031’ # function keys – F2 = u’ue032’ – F3 = u’ue033’ – F4 = u’ue034’ – F5 = u’ue035’ – F6 = u’ue036’ – F7 = u’ue037’ – F8 = u’ue038’ – F9 = u’ue039’ – F10 = u’ue03a’ – F11 = u’ue03b’ – F12 = u’ue03c’ – META = u’ue03d’ – COMMAND = u’ue03d’
cookie
-
driver.get_cookies() 获得cookie信息
-
add_cookie(cookie_dict) 向cookie添加会话信息
-
delete_cookie(name) 删除特定(部分)的cookie
-
delete_all_cookies() 删除所有cookie
ActionChains 类
-
context_click() 右击
-
double_click() 双击
-
drag_and_drop() 拖动