0

I am using Selenoid on a dedicated computer to run browsers.
The connection is as follows:

from seleniumwire import webdriver

chrome_options = webdriver.ChromeOptions()

chrome_options.add_argument('disable-infobars')
chrome_options.add_argument('--disable-extensions')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--ignore-certificate-errors')
chrome_options.add_experimental_option('prefs', prefs)
capabilities = {
    "browserName": "chrome",
    "selenoid:options": {
        "enableVNC": True
    }
}
capabilities.update(chrome_options.to_capabilities())

driver = webdriver.Remote(
    command_executor='http://<remote_ip>:4444/wd/hub',
    desired_capabilities=capabilities,
    seleniumwire_options={
        'auto_config': False,
        'addr': '0.0.0.0'
    }
)

The connection is ok, browser control works too, but when I want to get the list of requests it is empty:

driver.get('https://google.com')
print(driver.requests)

# []
nosheyakku
  • 130
  • 7

1 Answers1

0

Try the following patch:

# Go to the Google home page
driver.get('https://www.google.com')

# Access requests via the `requests` attribute
for request in driver.requests:
    if request.response:
        print(
            request.url,
            request.response.status_code,
            request.response.headers['Content-Type']
        )

You should get some result similar to this:

https://www.google.com/ 200 text/html; charset=UTF-8
https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png 200 image/png
https://consent.google.com/status?continue=https://www.google.com&pc=s&timestamp=1531511954&gl=GB 204 text/html; charset=utf-8
https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png 200 image/png
https://ssl.gstatic.com/gb/images/i2_2ec824b0.png 200 image/png
https://www.google.com/gen_204?s=webaft&t=aft&atyp=csi&ei=kgRJW7DBONKTlwTK77wQ&rt=wsrt.366,aft.58,prt.58 204 text/html; charset=UTF-8
...