这个是python+selenium_元素的size、text、属性值、元素是否可见
#coding=utf-8
from selenium import webdriver
import time
driver = webdriver.Firefox()
driver.get('http://www.baidu.com')
size = driver.find_element_by_id("kw").size
print(size)
#获取输入框的尺寸
text = driver.find_element_by_id("cp").text
print(text)
#页面底部备案信息
attribute = driver.find_element_by_id("kw").get_attribute('id')
print(attribute)
#返回元素属性值,可以是id,name,type
result = driver.find_element_by_id("kw").is_displayed()
print(result)
#返回元素的结果是否可见
driver.find_element_by_id("kw").clear()
time.sleep(2)
driver.find_element_by_id("kw").send_keys("selenium")
driver.find_element_by_id("su").click()
time.sleep(2)
#等等4秒
driver.quit()
#关闭浏览器