This is a block of code of my project
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.edge.service import Service
from selenium.webdriver.edge.options import Options
import time
def extract_data(self, usrname : str):
self.edge_options = Options()
self.edge_options.add_argument("--headless")
self.usrname = usrname
service = Service(executable_path=r'C:\web\msedgedriver.exe')
self.driver = webdriver.Edge(service=service)
self.driver.get(f'https://leetcode.com/{usrname}/')
I am using the –headless open also but the browser window is still opening instead of just working in background.
How to fix it?
You need to sign in to view this answers