Selenium - Python webdriver路径错误系统找不到指定的路径

时间:2014-11-21 09:28:57

标签: python firefox selenium webdriver

请帮助,FF配置文件有什么问题。我想使用Firefox和python webdriver

从网站保存文件
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.select import Select
import os
"""from bs4 import BeautifulSoup"""

fp = webdriver.FirefoxProfile()

fp.set_preference("browser.download.folderList",2)
fp.set_preference("browser.download.manager.showWhenStarting",False)
fp.set_preference("browser.download.dir", os.getcwd())
fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "text/html")

driver = webdriver.Firefox(firefox_profile=fp)
driver.get("http://achecker.ca/checker/index.php")
assert "Web Accessibility Checker" in driver.title
options = driver.find_element_by_link_text("Options")
options.click()
check_WCAG10 = driver.find_element_by_id("radio_gid_4")
check_WCAG10.click()
elem = driver.find_element_by_id("checkuri")
input_url = "naturasiberica.ru"
elem.send_keys(input_url)
elem.send_keys(Keys.RETURN)
# wait for result
try:
    element_exp_form = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "fileselect")))
except:
    driver.quit()
export_format = Select(driver.find_element_by_id("fileselect"))
export_format.select_by_value("html")
get_file = driver.find_element_by_id("validate_file_button")
get_file.click()
# wait for file_download
try:
    element_exp_form = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.ID, "fileselect"))
    )
finally:
    driver.quit()
driver.quit()

然后我有一个错误: [错误3]系统找不到指定的路径:' c:\ users \ semashko \ appdata \ local \ temp \ tmpr7lojx / '

0 个答案:

没有答案