DeprecationWarning: use options instead of chrome_options error using ChromeDriver and Chrome through Selenium on Windows 10 system DeprecationWarning: use options instead of chrome_options error using ChromeDriver and Chrome through Selenium on Windows 10 system google-chrome google-chrome

DeprecationWarning: use options instead of chrome_options error using ChromeDriver and Chrome through Selenium on Windows 10 system


This error message...

DeprecationWarning: use options instead of chrome_options

...implies that in your program you have used chrome_options to initiate a Selenium driven ChromeDriver initiated Browsing Context.

chrome_options is deprecated now and you have to use options instead as well as pass the absolute path of the ChromeDriver along with the extension.


Solution

As you are triggering your tests on a system, effectively you line of code will be:

options = webdriver.ChromeOptions()options.add_argument('--headless')driver = webdriver.Chrome(executable_path=r'C:\chromedriver_win32\chromedriver.exe', options=options)


It's ok!

from selenium import webdriverfrom selenium.webdriver.chrome.options import Optionschrome_options = Options()chrome_options.add_argument('--headless')browser = webdriver.Chrome(options=chrome_options)


no, the error will remain if you cover it like this

browser = webdriver.Chrome(options=chrome_options)

it will be right

browser = webdriver.Chrome(options=options)