Javatpoint Logo
Javatpoint Logo

get_log Driver Method - Selenium Python

Python automated testing can be done with the Selenium Python Module. The Selenium Python bindings provide a straightforward API for writing functional and acceptability tests with Selenium WebDriver. Visit Navigating links using the get method - Selenium Python to learn how to open a website using the testing tool. Simply being able to travel isn't all that useful. What we'd like to accomplish is interacting with pages-more particularly, the HTML elements contained within a page. See Locating Strategies for more ways to use Selenium to locate an element. Numerous practical methods to manage the session or browser are provided by Selenium WebDriver. Adding a cookie, using the back button, switching between tabs, etc.

The Selenium driver method get_log is the focus of this paper. The log for a specific type can be obtained using the get_log method.



The get_log method can now be used as a driver method, as seen below:

  • A WebDriver instance must first be created; in this case, a Chrome WebDriver, though other browsers such as Firefox or Internet Explorer may also be used.
  • Using driver.get(), you access a website.
  • To acquire the browser logs, use the driver.get_log("browser").

By including the appropriate log type as an option with the driver.get_log (), you can select to access any of these log kinds.

Remember that depending on the browser and the website you are using, the availability and content of logs may change. You can use the logs to monitor, debug, and troubleshoot your web automation scripts.

How can I use the Selenium Python get_log driver method?

Use the WebDriver's get_log method in Selenium Python as an example. Let's use the driver object from Let's obtain a browser log.


Screenshot of log -

get_log Driver Method - Selenium Python

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA