Collections:
Selenium Chrome WebDriver Logging in Python
How to turn on Chrome WebDriver logging with Selenium Python API?
✍: FYIcenter.com
If you want to turn on logging on the Chrome WebDriver server
with Selenium Python API, you need to specify the "service_args"
parameter as shown in this tutorial.
1. Enter the following program, ChromeWebDriverLogging.py, that turns on Chrome WebDriver server logging:
C:\fyicenter> type ChromeWebDriverLogging.py
# ChromeWebDriverLogging.py
# Copyright (c) FYIcenter.com
from selenium.webdriver import Chrome
driver = Chrome(service_args=["--verbose", "--log-path=ChromeDriver.log"])
driver.get("http://www.google.com");
driver.quit();
2. Run it. You see Chrome browser started with Google home page and closed immediately.
C:\fyicenter> python ChromeWebDriverLogging.py
3. View the log file:
C:\fyicenter> more ChromeDriver.log
[INFO]: Starting ChromeDriver 75.0.3770.90 (...-refs/branch-heads/3770@{#1003})
[INFO]: [b5b86271b18367d488491e09f95a6672] COMMAND InitSession {..}
[INFO]: Launching chrome: "C:\...\Google\Chrome\Application\chrome.exe" ...
[DEBUG]: DevTools HTTP Request: http://localhost:60558/json/version
[DEBUG]: DevTools HTTP Response: {...}
[DEBUG]: DevTools WebSocket Command: Log.enable (id=1) 90994CC4347DD37...
[DEBUG]: DevTools WebSocket Command: DOM.getDocument (id=2) 90994CC434...
[DEBUG]: DevTools WebSocket Command: Target.setAutoAttach (id=3) 90994...
[DEBUG]: DevTools WebSocket Command: Page.enable (id=4) 90994CC4347DD3...
[INFO]: [b5b86271b18367d488491e09f95a6672] COMMAND Navigate
{"url": "http://www.google.com"}
[INFO]: Waiting for pending navigations...
[INFO]: Done waiting for pending navigations. Status: ok
[INFO]: [b5b86271b18367d488491e09f95a6672] RESPONSE Navigate
[INFO]: [b5b86271b18367d488491e09f95a6672] COMMAND Quit {
As you can see, Chrome WebDriver server generated lots of log messages.
⇒ Compatibility of WebDriver Python API for Chrome
⇐ Chrome WebDriver Test with Selenium Python API
2019-09-27, ≈14🔥, 0💬
Popular Posts:
How to convert hexadecimal encoded data back to binary data (or Hex to Binary Decoding)? Hex to Bina...
Where to find online test tools? FYIcenter.com has prepared a number of online test tools: Data Look...
How to find out my browser's identification information? To help you to see your browser identificat...
How to turn on Chrome WebDriver logging with Selenium Python API? If you want to turn on logging on ...
How to update hidden input value field value with WebDriver in Python? Normally, a hidden input valu...