Reputation: 261
I am defining the download preferences in the setup method so everytime I need to download a file I do not have to define it seprately it will automatically download. Is this the right way to do that? It is giving me the error:
self.driver = webdriver.Chrome(options, executable_path=r"C:\chromedriver\chromedriver.exe")
TypeError: init() got multiple values for keyword argument 'executable_path'
class BaseTestCase(object):
def setUp(self):
options = webdriver.ChromeOptions()
options.add_argument("download.default_directory=os.getcwd()")
self.driver = webdriver.Chrome(options, executable_path=r"C:\chromedriver\chromedriver.exe")
#self.driver = webdriver.Chrome(options)
self.driver.maximize_window()
self.driver.get("https://abcc.com")
def tearDown(self):
self.driver.quit()
Upvotes: 0
Views: 37
Reputation: 31709
You are passing "download.default_directory=os.getcwd()"
as one string, i.e. the function os.getcwd()
is never executed. Change the line to
"download.default_directory={}".format(os.getcwd())
The correct format for initiating the webdriver is:
self.driver = webdriver.Chrome(executable_path=r"C:\chromedriver\chromedriver.exe", chrome_options=options)
Upvotes: 1