0

I used a code with Selenium on Python that types JavaScript code on Chrome console. That JS code returns me a list as the image show: console response I want to get the two People lists to python so I can work with them, How con I do that?

I tried other answers like:

logs =  driver.get_log('browser')
for log in logs:
    print(log)

But this get me a lot of errors, also I tried to get the logs of a different website just to learn how to get them, but this code doesn't get all the logs, just few of them.

Also I tried using DesiredCapabilities and verbose, enable logging but doesn't seems to work.

d = DesiredCapabilities.CHROME
d['loggingPrefs'] = { 'browser':'ALL' }
driver = webdriver.Chrome(desired_capabilities=d, options=options, service_args=["--verbose", "--enable-logging --v=1"])
toyota Supra
  • 3,181
  • 4
  • 15
  • 19

1 Answers1

0

Found a hint in resource

Looks like d['loggingPrefs'] = { 'browser':'ALL' } specification isn't supported with your chromedriver version (since 75.0.3770.8)

Try using the following:

d = DesiredCapabilities.CHROME
d['goog:loggingPrefs'] = { 'browser':'ALL' }
driver = webdriver.Chrome(desired_capabilities=d, options=options, service_args=["--verbose", "--enable-logging --v=1"])
kaliiiiiiiii
  • 925
  • 1
  • 2
  • 21