简体   繁体   English

如何使用python selenium获取Internet Explorer的浏览器控制台日志

[英]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. 我正在使用python selenium和Internet explorer为HTML5 Web应用程序编写测试自动化套件。 How to get the browser console logs of internet explorer using python selenium. 如何使用python selenium获取Internet Explorer的浏览器控制台日志。 I managed to get the console logs for the same application on the Google chrome.I used following code snippets 我设法在Google Chrome上获取相同应用程序的控制台日志。我使用了以下代码段

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 在上面的代码中,“print val”将在控制台上打印chrome浏览器日志。但是相同的代码不适用于Internet Explorer

I replace the chrome specific information with internet explorer specific information] 我用Internet Explorer特定信息替换chrome特定信息]

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 ? 如何使用python selenium获取Internet Explorer上任何应用程序的浏览器控制台?

The Internet Explorer driver does not support retrieval of logs of any kind. Internet Explorer驱动程序不支持检索任何类型的日志。 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. 这些功能将被忽略,并且从语言绑定到JSON有线协议的日志记录端点的调用将返回错误响应。 The protocol SPI is ill-defined, and had very little thought put into its design. SPI协议定义不明确,很少考虑其设计。 It is being reviewed and redesigned as part of the W3C spec effort. 它正在作为W3C规范工作的一部分进行审核和重新设计。 Once the redesign is done, I would expect the IE driver to adopt support at that time. 一旦重新设计完成,我希望IE驱动程序在那时采用支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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