2

I am getting this deprecation warning when I start my Selenium webdriver.Remote in python, my selenium version is selenium==4.0.0b2.post1

desired_capabilities has been deprecated, please pass in an Options object with options kwarg

What is that Option object supposed to be? How do I declare it?

This is my code:

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium import webdriver
import time

driver = webdriver.Remote(
    command_executor='http://localhost:4444/wd/hub',
    desired_capabilities=DesiredCapabilities.CHROME
)

driver.get('http://www.google.com/')
The Dan
  • 1,034
  • 2
  • 11
  • 29
  • Does this answer your question? [How do I pass options to the Selenium Chrome driver using Python?](https://stackoverflow.com/questions/12698843/how-do-i-pass-options-to-the-selenium-chrome-driver-using-python) – M Z Mar 31 '21 at 17:31
  • Thanks for your answer, but it seems to be unrelated to the question. "selenium.common.exceptions.WebDriverException: Message: Desired Capabilities must be a dictionary " – The Dan Mar 31 '21 at 18:09

1 Answers1

2

You can use Options instead of DesiredCapabilities in the following way:

from selenium import webdriver
import time

driver = webdriver.Remote(
    command_executor='http://localhost:4444/wd/hub',
    options=webdriver.ChromeOptions()
)

driver.get('http://www.google.com/')
arnaud1050
  • 66
  • 5