Reputation: 715
So I attempting to create a script using selenium webdriver (2.53.1) that can detect and log sites that are displaying mixed content. I did some quick looking around and found
Driver.Manage().Logs.GetLog(LogType.Browser);
but you must set up your driver with the following
ChromeOptions options = new ChromeOptions();
options.SetLoggingPreference(LogType.Browser, LogLevel.All);
driver = new ChromeDriver(options);
The above code worked for chrome but when I try a similar setup for my IEDriver
InternetExplorerOptions ieOptions = new InternetExplorerOptions();
ieOptions.SetLoggingPreference(LogType.Browser, LogLevel.All);
ieOptions.EnsureCleanSession = true;
ieOptions.RequireWindowFocus = true;
ieOptions.IgnoreZoomLevel = true;
Driver = new InternetExplorerDriver(ieOptions);
I get the following exception
Test Name: Test
Test FullName: sniper_regression.ExistingUser("ie").Test
Test Source: c:\git\sniper-regression\sniper-regression\ExistingUser.cs : line 559
Test Outcome: Failed
Test Duration: 0:00:32.02
Result Message:
System.InvalidOperationException : Command not found: POST /session/51ed52d9-5842-4fe6-b854-e40edad1654f/log
Command duration or timeout: 0 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'CHI-GRID-NODE1', ip: '10.34.161.112', os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, ie.enableFullPageScreenshot=true, enablePersistentHover=false, ie.forceCreateProcessApi=false, ie.forceShellWindowsApi=false, pageLoadStrategy=normal, ignoreZoomSetting=true, ie.fileUploadDialogTimeout=3000, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=true, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=true, browserName=internet explorer, initialBrowserUrl=http://localhost:43728/, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss}]
Session ID: 51ed52d9-5842-4fe6-b854-e40edad1654f
Result StackTrace:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.InternalExecute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteLogs.GetLog(String logKind)
at sniper_regression.ExistingUser.Test() in c:\git\sniper-regression\sniper-regression\ExistingUser.cs:line 559
Does GetLog()
require a different setup for IE? Any advice would be greatly appreciated, thank you.
Upvotes: 3
Views: 1552
Reputation: 27486
The IE driver does not now, and never has, supported any of the logging APIs. In part, this is because the (unpaid, volunteer) developer of the IE driver and the creator of WebDriver both consider the remote end of the API to be poorly designed, and the API is likely to change in the future. Additionally, the Internet Explorer browser itself does not programmatically expose all of the features required to successfully implement the WebDriver logging API as currently designed. However, the IE driver is available on GitHub, and pull requests implementing new features are accepted.
Upvotes: 2