简单元素操作.py

#清除文本:clear()#模拟按键输入:send_keys(*value)#点击元素:click()#回车/提交表单:submit()#获取输入框尺寸:from selenium import webdriverdriver = webdriver.Chrome()size = driver.find_element_by_id("kw").size#获取元素的文本信息:text = driver.find_element_by_id("cp").text#获取属性值:attribute = driver.find_element_by_id("kw").get_attribute("type")#返回元素的结果是否可见、结果为true或false:result = driver.find_element_by_id("kw").is_displayed()

相关推荐