0

We are working with the chromedriver via python selenium.

So i understand how to get the console log via this post but what I'm intersted in is getting the output of the function in the console log

driver.get_log('browser')

outputs

{'level': 'INFO',
 'message': 'https://public.website.com/stuff/stuff.js?v=numbers "function = "',
 'source': 'console-api',
 'timestamp': blah
},

In the developers console in chrome the function is evaluated in realtime and the results are outputted in json format in the console. How do I record those results?

EDIT: No luck so far. I would like to be able to return the evaluated js in any format.

Aaron Conway
  • 127
  • 4
  • 12
  • You can write it in a file to record it. – Murthi Jan 18 '18 at 11:26
  • @Murthi Would you mind showing that? How would writing the get_log to a file show the function output? – Aaron Conway Jan 18 '18 at 20:12
  • I wrote a pretty nifty framework for Selenium on python 2.7/3.6 that has this feature baked in and works for any browser/webdriver. If you wanted to check it out https://github.com/neetjn/py-component-controller – neet_jn Jan 18 '18 at 20:14
  • http://py-component-controller.readthedocs.io/en/latest/controller.html#get-browser-console-logs – neet_jn Jan 18 '18 at 20:14
  • @neet_jn Fantastic. Will check it out and update. – Aaron Conway Jan 18 '18 at 21:16
  • So after working with your framework I still have the same issue. Maybe I'mm not using it correctly. I need to get the evaluated js that comes up in the console. Currently It only returns where it was evaluated in the message. – Aaron Conway Jan 20 '18 at 00:59

0 Answers0