Selenium Test import sys, unittest, time, re, selenium class Sel(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() print "waiting" self.driver.implicitly_wait(30) self.base_url = "https://twitter.com" self.verificationErrors = [] print "going" self.accept_next_alert = True def test_sel(self): driver = self.driver delay = 3 driver.get(self.base_url + "/search?q=stckoverflow&src=typd") driver.find_element_by_link_text("View all").click() for i in range(1,5): self.driver.execute_script("window.scrollTo(0, document.body.scrollHeight);") time.sleep(4) html_source = driver.page_source data = html_source.encode('utf-8') print data if __name__ == "__main__": unittest.main()
Selenium Test