maybe someone met the issue... I use a custom 'chrome driver' for PyTest with 'performance' log:
cap = webdriver.DesiredCapabilities.CHROME.copy()
cap['goog:loggingPrefs'] = {'performance': 'ALL'}
services = Service(executable_path='/usr/local/bin/chromedriver')
chrome_driver = webdriver.Chrome(desired_capabilities=cap, options=options, service=services)
My environment:
- Selenium 4.0.0
- ChromeDriver 95.0.4638.17
And now I have got a warning:
=============================== warnings summary ===============================
tests/test_name.py::test_main[/]
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py:69: DeprecationWarning: desired_capabilities has been deprecated, please pass in a Service object
super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
-- Docs: https://docs.pytest.org/en/stable/warnings.html
======================== 1 passed, 1 warning in 10.49s =========================
May be someone know how does handle this?
CodePudding user response:
See below
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
options = webdriver.ChromeOptions()
options.set_capability("loggingPrefs", {'performance': 'ALL'})
service = ChromeService(executable_path'/usr/local/bin/chromedriver')
driver = webdriver.Chrome(service=service, options=options)
If the above doesn't work, try:
options.set_capability("goog:loggingPrefs", {'performance': 'ALL'})