0

I'm trying to get the content of each Chrome tab's console individually.

Here's what I've already tried:

capabilities["goog:loggingPrefs"] = {"browser": "ALL"}

# Get the current Chrome window handle
current_window_handle = driver.current_window_handle

# Iterate through all window handles / Tabs
for window_handle in driver.window_handles:

    # Switch to the window handle / Tab
    driver.switch_to_window(window_handle)

    # Get the Console content for the window handle
    logs = driver.get_log("browser")

But, get_log provides the complete Chrome browser log, and not of the individual current tab.

Instead I tried to use logs = driver.get_log("client") but that gives me an error message, saying that "client" doesn't exist.

Since I am able to clear the Logs of only the current individual Chrome Tab using: self.execute_script('console.clear();')

I wonder if there is another execute_script function, something like "console.read();" to return the content of only the current Chrome Tab, and if not, if there is any other approach to this.

0 Answers0