wkeeling / selenium-wire

Extends Selenium's Python bindings to give you the ability to inspect requests made by the browser.
MIT License
1.91k stars 256 forks source link

Selenium wire taking a long time on opening browser #400

Open Mobeen-Ghaffar opened 3 years ago

Mobeen-Ghaffar commented 3 years ago

I am working on browser automation using selenium-wire. But its long time on starting browser. I am using chrome and chromedriver lastest version. Is there any solution for it?

wkeeling commented 3 years ago

What kind of delay are you seeing when starting the browser? Can you share the code you're using?

Mobeen-Ghaffar commented 3 years ago
    chromedriver = "resources/driver/chromedriver.exe"
    options =  ChromeOptions()
    options.add_argument('--ignore-certificate-errors')
    options.add_argument('--ignore-ssl-errors')
    options.add_argument("--disable-notifications")
    options.add_argument('--disable-sync')
    # options.add_argument("--headless")
    # options.add_argument("--window-size=1920,1080")
    options.add_argument("--disable-popup-blocking")
    options.add_argument("--no-sandbox")
    options.add_argument("--disable-gpu")
    options.add_argument("--disable-dev-shm-usage")
    options.add_argument("--allow-running-insecure-content")
    options.add_argument('--log-level=3')
    options.add_argument('--ignore-certificate-errors-spki-list')
    options.add_argument('--disable-logging')
    # options.add_argument('--ignore-ssl-errors')
    # options.add_argument('--proxy-server=snkrs-us-pw-2.resdleafproxies.com:13795')
    prefs={
        "credentails_enable_service":False,
        "profile.password_manager_enabled":False,
        "profile.managed_default_content_settings.images":2,
        "javascript":2
    }
    options.add_argument("--start-maximized")
    options.add_argument("--disable-popup-blocking")
    options.add_argument("--disable-notifications")
    options.binary_location = 'resources/Chrome/chrome.exe'

    proxyoptions = {
        # 'mitm_http2': False,
        # 'verify_ssl': False,
        'backend': "mitmproxy",
        'mitm_http2': False,
        'disable_capture': True,
        'verify_ssl': True,
        'connection_keep_alive': False,
        'max_threads': 3,
        'connection_timeout': None,
        'proxy': {
            'http': f'http://{PROXY_USER}:{PROXY_PASS}@{PROXY_HOST}:{PROXY_PORT}',
            'https': f'http://{PROXY_USER}:{PROXY_PASS}@{PROXY_HOST}:{PROXY_PORT}',
        }
    }
   driver = Chrome(executable_path=chromedriver,options=options,seleniumwire_options=proxyoptions)
Mobeen-Ghaffar commented 3 years ago

Here is my code. I taking usually 1-2 minutes to open up chrome browser

Mobeen-Ghaffar commented 3 years ago

Any idea why it taking so long?

wkeeling commented 3 years ago

That looks ok as far as I can see so I'm not sure why it's taking so long. Does it take the same amount of time if you use pure Selenium?

Mobeen-Ghaffar commented 3 years ago

Issue in undetected_chromedriver v2 version. Undetected_chromedriver v1 version works fine.