question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

driver.Requests is empty with firefox driver

See original GitHub issue

im trying to run the code snippet in the docs but my driver.Requests doesn’t return anything.

from seleniumwire import webdriver  # Import from seleniumwire

# Create a new instance of the Firefox driver
driver = webdriver.Firefox(seleniumwire_options={'port':6000})

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

driver.requests

driver.requests returns [] seleniumwire version: 4.0.2, selenium version 3.141.0, python 3.7.5

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Shakis87commented, Feb 8, 2021

Okay it seems to have been something in my code that was causing it to mess up, sorry for the inconveneince. The following wokrs:

from seleniumwire import webdriver
from selenium import webdriver as normal_webdriver
import time
import random

proxy_list = [
    # list of my proxy IPs
]
proxy = random.choice(proxy_list)

profile = normal_webdriver.FirefoxProfile()
# Set various profile options
profile.update_preferences()

swoptions = {
    'proxy': {
        'http': f'http://{proxy}',
        'https': f'https://{proxy}',
    },
    'ignore_http_methods': [],
    # 'port': int(PROXY_PORT),
}

driver = webdriver.Firefox(seleniumwire_options=swoptions, firefox_profile=profile, executable_path='geckodriver.exe')
driver.get('https://bbc.co.uk')
time.sleep(5)
print(driver.requests)

This spam a few errors though:

127.0.0.1:55451: Client Handshake failed. The client may not trust Selenium Wire's certificate for firefox.settings.services.mozilla.com.
127.0.0.1:55464: Client Handshake failed. The client may not trust Selenium Wire's certificate for firefox.settings.services.mozilla.com.
127.0.0.1:55475: Client Handshake failed. The client may not trust Selenium Wire's certificate for firefox.settings.services.mozilla.com.
127.0.0.1:55503: Client Handshake failed. The client may not trust Selenium Wire's certificate for firefox.settings.services.mozilla.com.

But I think I can get everything to work from here.

0reactions
Shakis87commented, Feb 8, 2021

I removed all the sw options and it still won’t work, in another part of my script I do set a normal selenium/firefox profile but it isn’t used, I’ll try removing that too

driver = webdriver.Firefox(executable_path='geckodriver.exe')
driver.get('https://bbc.co.uk')
print(driver.requests)

output: []

Read more comments on GitHub >

github_iconTop Results From Across the Web

empty requests in seleniumwire python - Stack Overflow
I'm using selenium-wire to scrape requests headers in Ubuntu 18.04 and using Firefox driver. But driver.requests is empty. what's the ...
Read more >
driver.requests empty when using with safari #104 - GitHub
I am trying to get all requests made when I go to a website. When I use Chrome as the webdriver, it works...
Read more >
1471262 - WebDriver:TakeScreenshot returns empty string
Yes I can help if I can. I am not familiarized how to debug Mozilla code from another project (in my case, my...
Read more >
selenium-wire - PyPI
Chrome, Firefox, Edge and Remote Webdriver supported ... This is more efficient than using driver.requests[-1]. ... Empty for non-HTTPS requests.
Read more >
7. WebDriver API — Selenium Python Bindings 2 documentation
Uninstalls Firefox addon using its identifier. Usage: driver.uninstall_addon('addon ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found