Error: fp.set_preference(“browser.download.dir”,getcwd()) NameError:
name ‘getcwd’ is not defined
getcwd()
is not defined. So I assume you want the getcwd
from the os
module:
add: import os
, and then invoke with os.getcwd()
.
or you could just add the import for this function:
from os import getcwd
your example with the proper imports included:
import os
from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.set_preference('browser.download.folderList', 2)
profile.set_preference('browser.download.manager.showWhenStarting', False)
profile.set_preference('browser.download.dir', os.getcwd())
profile.set_preference('browser.helperApps.neverAsk.saveToDisk', 'text/csv/xls')
driver = webdriver.Firefox(profile)