using selenium to run Firefox in headless mode error: 'Options' object has no attribute 'binary'

337 Views Asked by At

I just started using selenium and wanted to check the status of a ps5 at Walmart but I get the error 'Options' object has no attribute 'binary' it worked fine before I tried to run it in headless mode.

from selenium import webdriver
from selenium.webdriver.chrome.options import Options


options = Options()
options.add_argument("--headless")
driver = webdriver.Firefox(options=options)

driver.get('https://www.walmart.com/ip/Sony-PlayStation-5-Video-Game-Console/994712501')

print(driver.find_element_by_css_selector("div[class='prod-blitz-copy-message']").text)
1

There are 1 best solutions below

0
YaDav MaNish On

You are using Firefox

Instead of this

from selenium.webdriver.chrome.options import Options

import it as

from selenium.webdriver.firefox.options import Options


driver = webdriver.Firefox(firefox_options=option)