如何在seleniumwire中无头运行Firefox



我正试图在无头模式下用Firefox运行selenium wire:

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")

它没有任何效果,因为浏览器窗口仍然弹出:(

在硒元素中,我通常像一样运行它

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")

我怎么能无头运行它?

我必须检查seleniumwire文件,这种组合对我有效

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 )

快乐刮

相关内容

  • 没有找到相关文章