简体   繁体   中英

How to get the browser console logs of internet explorer using python selenium

I am writing a test automation suite for the HTML5 web application using the python selenium and internet explorer. How to get the browser console logs of internet explorer using python selenium. I managed to get the console logs for the same application on the Google chrome.I used following code snippets

chromedriver="C:\Python27\chromedriver.exe"
os.environ["webdriver.chrome.driver"]=chromedriver
# enable browser logging
d = DesiredCapabilities.CHROME 
d['loggingPrefs'] = { 'browser':'ALL' }
driver=webdriver.Chrome(executable_path=chromedriver,desired_capabilities=d)


# test specific code in python selenium


# printing the chrome browser specific logs on console
for entry in driver.get_log('browser'):
    for key,val in entry.items() :
        if key == "message" :
            print val 

In above code the "print val" will print the chrome browser logs on console.But same code is not working for the internet explorer

I replace the chrome specific information with internet explorer specific information]

Iedriver="C:\Python27\IEDriverServer.exe"
os.environ["webdriver.Ie.driver"]=  Iedriver
# enable browser logging
d = DesiredCapabilities.INTERNETEXPLORER
d['loggingPrefs'] = { 'browser':'ALL' }
driver=webdriver.Ie(Iedriver,d)

But I am not able to get the browser specific logs. Can some one help me on this ? How to get the browser console of any application on internet explorer using python selenium ?

The Internet Explorer driver does not support retrieval of logs of any kind. The capabilities will be ignored, and calls from the language bindings to the logging end points of the JSON wire protocol will return error responses. The protocol SPI is ill-defined, and had very little thought put into its design. It is being reviewed and redesigned as part of the W3C spec effort. Once the redesign is done, I would expect the IE driver to adopt support at that time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM