I am navigating through the web with python and downloaded some files. However, I do not want to open edge, just want to download the files, but python opens edge automatically. How do I get around this?
Some of my code include:
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
driver = webdriver.Edge()
driver.get("myURL")
time.sleep(2)
id_box = driver.find_element(By.ID,"id")
id_box.send_keys("username")
# And much more...
CodePudding user response:
You can use the option to run the webdriver in headless mode. This means that the webdriver will run in the background and not open a GUI window. You can set this option when initializing the webdriver. Here's an example of how you can set this option for Edge:
from selenium import webdriver
options = webdriver.EdgeOptions()
options.add_argument('--headless')
driver = webdriver.Edge(options=options)
driver.get("myURL")
CodePudding user response:
I think what you want is edge to run "headless".
Didn't find a solution using bare selenium.
There seems to be a solution at link