0

I am trying to monitor the network in the IE Webdriver, the following is my code:

import time
import psutil
import os
import json

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities


import trackin_config

caps = DesiredCapabilities.INTERNETEXPLORER
caps['loggingPrefs'] = {'performance': 'ALL'}
browser = webdriver.Ie(trackin_config.WEB_DRIVER, desired_capabilities=caps)
browser.get(trackin_config.MES_WEBSITE)

def process_browser_log_entry(entry):
    response = json.loads(entry['message'])['message']
    return response
    
browser_log = browser.get_log('performance') 
events = [process_browser_log_entry(entry) for entry in browser_log]
events = [event for event in events if 'Network.response' in event['method']]

print(events)

However I am getting the following error:

File "c:/Adhil/Python/MES_BOT/trackin-bot.py", line 43, in <module>
    browser_log = browser.get_log('performance')
  File "C:\Users\Adh\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 1262, in get_log
    return self.execute(Command.GET_LOG, {'type': log_type})['value']
  File "C:\Users\Adh\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Adh\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 208, in check_response
    raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message:

Please advise, is there any package i need to install or configure?

Adhil
  • 1,678
  • 3
  • 20
  • 31
  • Maybe try `browser.get_log('browser')` or another option listed here: https://selenium-python.readthedocs.io/api.html#selenium.webdriver.remote.webdriver.WebDriver.get_log – orde Sep 21 '19 at 15:33
  • I did try, but get_log('browser') also flags the same error with no message – Adhil Sep 22 '19 at 01:46
  • Possible duplicate of [Cannot call non W3C standard command while in W3C mode (Selenium::WebDriver::Error::UnknownCommandError) with Selenium ChromeDriver in Cucumber Ruby](https://stackoverflow.com/questions/56111529/cannot-call-non-w3c-standard-command-while-in-w3c-mode-seleniumwebdrivererr) – Guy Sep 23 '19 at 04:28

1 Answers1

0
errors = {}

for entry in context.browser.get_log('browser'):
   errors.update(entry)
Andrew Regan
  • 5,087
  • 6
  • 37
  • 73
Boikot
  • 304
  • 2
  • 9