wkeeling / selenium-wire

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

Using proxy in selenium-wire & undetected_chromedriver changes request methot to OPTIONS #657

Open DUB1401 opened 1 year ago

DUB1401 commented 1 year ago

System

OS: Windows 11 22H2 Python: 3.9.13 selenium-wire: 5.1.0 undetected-chromedriver: 3.4.6 Goggle Chrome: 110.0.5481.105 Target site protocols: SSLv2, TLS 1.3

Error description

When i use selenium-wire & undetected_chromedriver together with proxy, requests method on Google Chrome browser changes from GET to OPTIONS, and this all requests forbiddened. Without proxy all works.

Reproduction

from selenium.webdriver.support.ui import WebDriverWait
import seleniumwire.undetected_chromedriver.v2 as uc
from selenium.webdriver.common.by import By

options = {
    "proxy": {
        "https": "https://{LOGIN}:{PASSWORD}@{IP}:{PORT}"
    }
}

chrome_options = uc.ChromeOptions()
driver = uc.Chrome(seleniumwire_options=options, options=chrome_options)
driver.get("https://remanga.org/")

# Clicking Cloudflare hcaptcha buttons in automatically mode.
try:
    WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CLASS_NAME, "big-button"))).click()
except selenium.common.exceptions.TimeoutException:
    pass

try:
    WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CLASS_NAME, "hcaptcha-box"))).click()
except selenium.common.exceptions.TimeoutException:
    pass

After this code execution site is opens (not all \<div> loads), but requests method changes to OPTIONS.

Using proxy:

image

Without proxy:

image

Note If DevTools shows «Provisional headers are shown» message, clear all coockies before accessing.

Already try