0

I'm trying to run selenium-wire with Firefox in headless mode:

from seleniumwire import webdriver

options = {
    'proxy': {
        'http': 'http://user:password@ip:port',
        'https': 'https://user:password@ip:port',
        'no_proxy': 'localhost,127.0.0.1,dev_server:8080'
    },
    'headless': True
}
driver = webdriver.Firefox(seleniumwire_options=options)
driver.get("http://adream.es")

It's not making any effect because the browser window still pops up :(

In selenium normally I was running it like:

from selenium import webdriver
from selenium.webdriver.firefox.options import Options

options = Options()
options.headless = True
driver = webdriver.Firefox(options=options)
driver.get("http://adream.es")

How can I run it headless?

kuhi
  • 531
  • 5
  • 23

1 Answers1

0

I had to check into the seleniumwire files, this combination worked for me

from selenium.webdriver import FirefoxOptions
from seleniumwire import webdriver as seleniumwire_webdriver
fireFoxOptions = FirefoxOptions()
fireFoxOptions.headless = True

seleniumwire_options = {
    'proxy': {
        'http': 'http://user:password@ip:port',
        'https': 'https://user:password@ip:port',
        'no_proxy': 'localhost,127.0.0.1,dev_server:8080'
    }
}

driver = webdriver.Firefox(
    options=fireFoxOptions,
    seleniumwire_options=seleniumwire_options )

happy scraping

dasfacc
  • 148
  • 2
  • 8