I am using python language bindings of selenium. The application under test is a WEBRTC application, which does write debug information to console logs of the browser. Need to get these log information when running the tests. I am able to get the logs when the browser is run on the same system, but when I run the same code with Grid on a remote browser the logs aren't returned even though they appear in the browser. I also tried using the -browserConsoleLog option when configuring the node to the hub, but even that did not work.
chrome_opts=webdriver.ChromeOptions()
desired_caps = chrome_opts.to_capabilities()
desired_caps.update({'loggingPrefs':{ 'browser':'ALL'}})
By enabling the logging prefs as shown above, I am able to get the console-api and network logs from the browser when it is run locally as:
driver=webdriver.Chrome(desired_caps)
driver.get(app_url)
logs = driver.get_log("browser")
# returns all the console-api, network and browser logs as I read from one of the posts
for log in logs:
if log.get('source')=='console-api':
print log.get('message')
But when I use the same desired capabilties with a remote browser as shown below, get_logs doesn't return console logs though it appears in the browser console
driver=webdriver.Remote(command_executor=hub_url,desired_capabilities=desired_caps)
Any help?