wkeeling / selenium-wire

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

Seleniumwire config for remote selenoid #619

Open sergeycommit opened 1 year ago

sergeycommit commented 1 year ago

wireoptions = { 'auto_config': False, 'addr': '127.0.0.1', 'port': 8098, }

capabilities["browserName"] = "chrome" capabilities["selenoid:options"] = {"enableVNC": True} capabilities['goog:chromeOptions'] = {'extensions': [], 'args': ['--proxy-server=host.docker.internal:8098', '--ignore-certificate-errors'] }

return driverwire.Remote(command_executor=SELENOID_REMOTE_URL, seleniumwire_options=wireoptions, options=options, desired_capabilities=capabilities)

This config good works with selenoid docker locally, but dont work on remote host in docker with such error: selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_PROXY_CONNECTION_FAILED.

That config use?

wkeeling commented 1 year ago

Using a remote host can only work if the remote host is able to access the machine running Selenium Wire. This is because the remote host needs to send its requests back to Selenium Wire for capture. So it would mean that you'd need to start Selenium Wire on a public facing IP address and not 127.0.0.1 and that public address must be accessible by remote Selenoid.

pedrofnts commented 1 year ago

@wkeeling what if I don't have a static IP address and port at my host, but a custom domain?