selenium-wire icon indicating copy to clipboard operation
selenium-wire copied to clipboard

Don't working with proxy

Open Petr2282 opened this issue 3 years ago • 5 comments

Hi wkeeling, I am trying simply to intercept requests and all working without using proxy, but when connect to any proxy using seleniumwire_options it starts to return non type obejcts.

Petr2282 avatar Apr 22 '22 09:04 Petr2282

Can you explain what you mean about "non type obejcts"? Do you have some code that demonstrates the problem?

wkeeling avatar Apr 22 '22 09:04 wkeeling

elif driver == Driver.FIREFOX:

    options = webdriver.FirefoxOptions()
    options.headless = headless
    options.set_preference(
        "general.useragent.override",
        f"{generate_useragent('firefox')}"
    )
    options.set_preference("dom.webdriver.enabled", False)
    options.binary_location = FIREFOX_PATH
    
    options.proxy = p2({
        'proxyType': ProxyType.MANUAL,
        'httpProxy': proxy,
        'ftpProxy' : proxy,
        'sslProxy' : proxy,
        'noProxy'  : ''
    })
    print("Proxy: " + proxy)
    
    woptions = {
        'proxy': {
            'http': 'http://' + proxy,
            'https': 'https://' + proxy
        }
    }
    return webdriver.Firefox(
        seleniumwire_options=woptions,
        executable_path=GECKODRIVER_PATH,
        options=options
    )
else:
    raise Exception("Unknown driver type")

Petr2282 avatar Apr 22 '22 10:04 Petr2282

Can you explain what you mean about "non type obejcts"? Do you have some code that demonstrates the problem?

example of set up

Petr2282 avatar Apr 22 '22 10:04 Petr2282

@Petr2282

    options.proxy = p2({
        'proxyType': ProxyType.MANUAL,
        'httpProxy': proxy,
        'sslProxy' : proxy,
        'noProxy'  : ''
    })

or:


    options.proxy = p2({
        'proxyType': ProxyType.MANUAL,
        'httpProxy': proxy,
        'sslProxy' : proxy,
    })

firefox no longer support ftp-proxy.

alimp5 avatar Jun 04 '22 08:06 alimp5

@Petr2282 is this issue still affecting you?

I notice in your code above that you're trying to set the upstream proxy with:

    options.proxy = p2({
        'proxyType': ProxyType.MANUAL,
        'httpProxy': proxy,
        'ftpProxy' : proxy,
        'sslProxy' : proxy,
        'noProxy'  : ''
    })

This configuration shouldn't be used for upstream proxies - only use seleniumwire_options.

wkeeling avatar Jun 17 '22 11:06 wkeeling