#tag_name定位
from selenium import webdriver
from time import sleep
driver=webdriver.Fixfox()
driver.get("http://www.yanfan.com")
driver.find_element_by_tag_name("input").send_keys("selenium")
#driver.find_elements_by_tag_name("input")[0].send_keys("selenium")
sleep(4)
driver.quit()
#class_name定位
from selenium import webdriver
from time import sleep
driver=webdriver.Firefox()
driver.get("http://www.baidu.com")
driver.find_element_by_class_name("s_ipt").send_keys("selenium")
sleep(2)
driver.find_element_by_id("su").click()
sleep(3)
driver.quit()
# link_text定位
from selenium import webdriver
from time import sleep
driver=webdriver.Firefox()
driver.get("http://www.126.com")
driver.find_element_by_link_text("程序开发").click() #精确定位
sleep(3)
driver.find_element_by_partial_link_text('神秘面纱').click() #模糊定位
sleep(3)
driver.quit()