1 2 3 4 5 6 7 8 9 10 11 12 13
| from selenium import webdriver import os fp = webdriver.FirefoxProfile() fp.set_preference("browser.download.folderList",0) fp.set_preference("browser.download.manager.showhenStarting",True) fp.set_preference("browser.download.dir",os.getcwd()) fp.set_preference("browser.helperApps.neverAsk.saveToDisk","applaction/octet-stream")
driver = webdriver.Firefox(firefox_profile = fp) driver.get("http://pypi.Python.org/pypi/selenium") driver.find_element_by_xpath("//*[@id='download-button']/a").click() driver.find_element_by_xpath("//*[@id='content']/div[3]/table/tbody/tr[3]/td[1]/span/a[1]").click()
|