use options instead of chrome_options problem solving

The use of selenium can be called google, firebox browser and other reptiles crawling, but when I run:

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

chrome_options = Options()
chrome_options.add_argument('--headless')
driver = webdriver.Chrome(chrome_options=chrome_options)

driver.get("http://www.cip.cc/")

When there has been such a problem:

E:\pycharm\project_PaChong\venv\Scripts\python.exe E:/pycharm/project_PaChong/test_1.py
E:/pycharm/project_PaChong/test_1.py:27: DeprecationWarning: use options instead of chrome_options
  driver = webdriver.Chrome(chrome_options=chrome_options)

Yes, when I tried the code will be replaced free browser mode execution time, the emergence of this warning; although not affect the execution, but obsessive-compulsive disorder I still want to solve it.

 

[DeprecationWarning: use options instead of chrome_options] ---> [Warning: Use option instead of chrome_options]

 

Look at this sentence translation can probably guess, this parameter is deprecated and should be replaced with new parameters;

After some searching to find a replacement for this parameter parameter;


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

chrome_options = Options()
chrome_options.add_argument('--headless')
driver = webdriver.Chrome(options=chrome_options)

driver.get("http://www.cip.cc/")

Yes, will replace chrome_options as options can be.

Guess you like

Origin blog.51cto.com/13577495/2461545