常用的模块:
1 from selenium import webdriver 2 from selenium.webdriver.common.keys import Keys 3 import unittest
隐式等待:
self.browser = webdriver.Firefox()
# if the element is not loaded, wait 3 seconds
self.browser.implicitly_wait(3)
查找元素API:
1 1 new_item = self.browser.find_element_by_id(‘id_new_item‘) 2 2 h1 = self.browser.find_elements_by_tag_name(‘h1‘) 3 3 table = self.browser.find_element_by_tag_name(‘table‘) 4 4 rows = table.find_elements_by_tag_name(‘tr‘)
原文:http://www.cnblogs.com/jcsz/p/5414436.html