Python Selenium - DeprecationWarning: firefox_profile has been deprecated, please use an Options object

Python Selenium - DeprecationWarning: firefox_profile has been deprecated, please use an Options object

Při použití Python Selenium s konstrukcí níže může nastat chyba DeprecationWarning: firefox_profile has been deprecated, please use an Options object

profile     = webdriver.FirefoxProfile('/home/ccc/.mozilla/firefox/l14zaesm.default-release')

driver = webdriver.Firefox(profile)
driver.get("https://www.up4.cz")

 

Řešení

Je potřeba importovat

from selenium.webdriver import Firefox
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.firefox.options import Options

 

a upravit konstrukci takto:

    options = Options()
    options.set_preference('profile', profile_path)
    service = Service('/usr/bin/geckodriver')
    driver = Firefox(service=service, options=options)
    driver.get("https://www.up4.cz")

 

 

Související obsah

linux

python

selenium

web

Komentáře

Vaše reakce na Python Selenium - DeprecationWarning: firefox_profile has been deprecated, please use an Options object

Reference

Podívejte se na naše reference

Prohlédnout

Aplikace

Podívejte se na naše aplikace

Prohlédnout

Co umíme?

Podívejte se co umíme

Prohlédnout

Co umíme?

Vytváříme sofistikované aplikace pro náročné

Od webových aplikací přes android až po převodové můstky či složité informační systémy.

Podívejte se k nám

Máte ještě čas? Podívejte se na další rubriky

Tento web používá soubory cookie. Dalším procházením tohoto webu vyjadřujete souhlas s jejich používáním.. Více informací zde.