Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot able to change the default download directory and browser closes after last command without quit command #54

Closed
krishna3008 opened this issue Oct 14, 2021 · 1 comment

Comments

@krishna3008
Copy link

krishna3008 commented Oct 14, 2021

My code is

from msedge.selenium_tools import Edge, EdgeOptions
from webdriver_manager.microsoft import EdgeChromiumDriverManager
import os, time

options = EdgeOptions()
# options.use_chromium = True
# options.add_argument("headless")
# options.add_argument("disable-gpu")
prefs = {'safebrowsing.enabled': 'false','download.default_directory' : os.getcwd() + os.path.sep}
options.add_experimental_option("prefs", prefs)
options.add_experimental_option("useAutomationExtension", False)

driver.get('https://github.com/')

Please help me on this
I want to run this on headless and download the files to a desired directory
especially from wher the code is triggered

@bwalderman
Copy link
Contributor

@krishna3008 I don't see where the driver is created in the sample code, but you need to create and configure the EdgeOptions first, and then pass them to the driver. EdgeOptions cannot be changed after the driver is created. For example:

options = EdgeOptions()
options.add_argument("headless")
prefs = {'safebrowsing.enabled': 'false','download.default_directory' : os.getcwd() + os.path.sep}
options.add_experimental_option("prefs", prefs)

driver = Edge(options = options)

I'm going to close this issue since this repo is now deprecated. Please upgrade to Selenium 4 which has built-in support for Microsoft Edge (Chromium). For help with upgrading, see https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/#upgrading-from-selenium-3. If you need further help with this issue, you can contact the Edge DevTools team at https://docs.microsoft.com/en-us/microsoft-edge/devtools-guide-chromium/contact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants