selenium search

from selenium import webdriver from selenium.webdriver.common.keys import Keys import unittest class Untitled(unittest.TestCase):     def setUp(self):         self.driver = webdriver.Firefox()         self.base_url = "http://www.google.com.hk/"          def test_untitled(self):         driver = self.driver         driver.get(self.base_url)         assert "Google" in driver.title         elem = driver.find_element_by_name("q")         elem.send_keys('selenium')         elem.send_keys(Keys.RETURN)         assert "selenium - Google 搜索" in driver.title         driver.close()        if __name__ == "__main__":     unittest.main()
相關文章
相關標籤/搜索