Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (120 points)
my code:

from selenium import webdriver

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

caps = DesiredCapabilities.CHROME

caps['loggingPrefs'] = {'performance': 'ALL'}

driver = webdriver.Chrome(desired_capabilities=caps)

driver.get('https://www.google.com')

for entry in driver.get_log('performance'):

    print(entry)

driver.quit()

3 Answers

0 votes
by (1.3k points)

If you encounter the error "Log type 'performance' not found" when using the code you provided, it may indicate that the browser driver you are using does not support retrieving performance logs. Here are a few steps you can take to troubleshoot and resolve the issue:

  1. Update Selenium and WebDriver: Make sure you have the latest versions of Selenium and the WebDriver for Chrome installed. Outdated versions may lack support for retrieving performance logs.

  2. Check ChromeDriver version: Ensure that you have the correct version of ChromeDriver that is compatible with the version of Chrome you have installed. Mismatched versions could result in compatibility issues.

  3. Enable verbose logging: You can try enabling verbose logging to get more information about the error. Add the following line before creating the driver instance:

caps['goog:chromeOptions'] = {'perfLoggingPrefs': {'enableNetwork': True, 'enablePage': True}}
  1. Use a different browser driver: If the issue persists, consider using a different browser driver such as GeckoDriver for Firefox. The Firefox WebDriver generally provides better support for retrieving performance logs.

Keep in mind that performance log retrieval is dependent on the browser and the WebDriver implementation. It's possible that certain versions or configurations may not support retrieving performance logs.

0 votes
by (640 points)

If you encounter the error "Log type 'performance' not found" while running the provided code, it suggests that the browser driver being used may not support retrieving performance logs. To address this issue, you can try the following steps:

  1. Ensure Selenium and WebDriver are up to date: Make sure you have the latest versions of Selenium and the WebDriver for Chrome installed. Older versions might lack support for retrieving performance logs, so updating to the latest versions can resolve compatibility issues.

  2. Verify ChromeDriver compatibility: Check that you have the appropriate version of ChromeDriver that is compatible with your installed Chrome browser. Mismatched versions could result in issues with performance log retrieval.

  3. Enable verbose logging: To gather more information about the error, you can enable verbose logging. Add the following line before creating the driver instance:

caps['goog:chromeOptions'] = {'perfLoggingPrefs': {'enableNetwork': True, 'enablePage': True}}
  1. Consider using a different browser driver: If the problem persists, you might want to try using a different browser driver, such as GeckoDriver for Firefox. The Firefox WebDriver generally provides better support for retrieving performance logs.

It's important to note that the availability of performance log retrieval depends on the specific browser and WebDriver implementation. Certain versions or configurations may not support retrieving performance logs. If your objective is to obtain network-related information, alternative approaches like using network traffic monitoring tools or capturing network requests using browser developer tools (e.g., Chrome DevTools) can be considered.

0 votes
ago by (1.8k points)
In the event that the message “logtype performance not found” pops up as you are attempting to run Selenium with Chrome, it is necessary to understand how the ChromeDriver is implemented and how the logs can be enabled.

 Chrome drivers as well as Chrome browsers need to be updated since they can be the source of the logging problem since they are not properly aligned.

 The main improvement is that instead of ‘loggingPrefs’, the ‘goog:loggingPrefs’ will be utilized. In this regard, replace the caps dictionary with ‘goog:loggingPrefs’: {‘performance’: ‘ALL’}.

 This will enable the system to log every performance of the chrome driver. It should be also remembered that the version of ChromeDriver has also to be the same as the version of the installed Chrome.

Once these steps have been completed, this error will not be displayed and it will be possible to extract and print the performance logs.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...