diff --git a/Aquality.Selenium/src/Aquality.Selenium/Browsers/Browser.cs b/Aquality.Selenium/src/Aquality.Selenium/Browsers/Browser.cs index 0f700c47..69437224 100644 --- a/Aquality.Selenium/src/Aquality.Selenium/Browsers/Browser.cs +++ b/Aquality.Selenium/src/Aquality.Selenium/Browsers/Browser.cs @@ -8,6 +8,7 @@ using System.Reflection; using System; using Aquality.Selenium.Core.Waitings; +using System.Collections.ObjectModel; namespace Aquality.Selenium.Browsers { @@ -18,6 +19,7 @@ public class Browser : IApplication { private TimeSpan implicitWaitTimeout; private TimeSpan pageLoadTimeout; + private readonly IBrowserProfile browserProfile; private readonly IConditionalWait conditionalWait; @@ -241,6 +243,19 @@ public byte[] GetScreenshot() return Driver.GetScreenshot().AsByteArray; } + /// + /// Gets logs from WebDriver. + /// + /// Type of logs + /// ReadOnlyCollection of log entries. + /// + /// Does not work on current version of Selenium WebDriver. Issue: https://github.com/SeleniumHQ/selenium/issues/7323 + /// + public ReadOnlyCollection GetLogs(string logKind) + { + return Driver.Manage().Logs.GetLog(logKind); + } + /// /// Scrolls window by coordinates. /// diff --git a/Aquality.Selenium/src/Aquality.Selenium/Browsers/BrowserTabNavigation.cs b/Aquality.Selenium/src/Aquality.Selenium/Browsers/BrowserTabNavigation.cs index 24e0faa3..d88ef17f 100644 --- a/Aquality.Selenium/src/Aquality.Selenium/Browsers/BrowserTabNavigation.cs +++ b/Aquality.Selenium/src/Aquality.Selenium/Browsers/BrowserTabNavigation.cs @@ -62,10 +62,10 @@ public void SwitchToLastTab(bool closeCurrent = false) CloseAndSwitch(TabHandles.Last(), closeCurrent); } - public void SwitchToTab(string handle, bool closeCurrent = false) + public void SwitchToTab(string tabHandle, bool closeCurrent = false) { - Logger.Info("loc.browser.switch.to.tab.handle", handle); - CloseAndSwitch(handle, closeCurrent); + Logger.Info("loc.browser.switch.to.tab.handle", tabHandle); + CloseAndSwitch(tabHandle, closeCurrent); } public void SwitchToTab(int index, bool closeCurrent = false) diff --git a/Aquality.Selenium/src/Aquality.Selenium/Browsers/IBrowserTabNavigation.cs b/Aquality.Selenium/src/Aquality.Selenium/Browsers/IBrowserTabNavigation.cs index 3d112918..e8dde20e 100644 --- a/Aquality.Selenium/src/Aquality.Selenium/Browsers/IBrowserTabNavigation.cs +++ b/Aquality.Selenium/src/Aquality.Selenium/Browsers/IBrowserTabNavigation.cs @@ -22,7 +22,7 @@ public interface IBrowserTabNavigation /// /// Switches to tab. /// - /// Tab handle. + /// Tab handle. /// Close current tab if true and leave it otherwise. void SwitchToTab(string tabHandle, bool closeCurrent = false); diff --git a/Aquality.Selenium/src/Aquality.Selenium/Browsers/LocalBrowserFactory.cs b/Aquality.Selenium/src/Aquality.Selenium/Browsers/LocalBrowserFactory.cs index fc6cb307..11374b41 100644 --- a/Aquality.Selenium/src/Aquality.Selenium/Browsers/LocalBrowserFactory.cs +++ b/Aquality.Selenium/src/Aquality.Selenium/Browsers/LocalBrowserFactory.cs @@ -46,7 +46,7 @@ private Browser CreateBrowser() break; case BrowserName.Firefox: SetUpDriver(new FirefoxConfig(), driverSettings); - FirefoxDriverService geckoService = FirefoxDriverService.CreateDefaultService(); + var geckoService = FirefoxDriverService.CreateDefaultService(); geckoService.Host = "::1"; driver = GetDriver(geckoService, (FirefoxOptions)driverSettings.DriverOptions, commandTimeout); break; diff --git a/Aquality.Selenium/src/Aquality.Selenium/Resources/settings.json b/Aquality.Selenium/src/Aquality.Selenium/Resources/settings.json index 74733687..e74690cc 100644 --- a/Aquality.Selenium/src/Aquality.Selenium/Resources/settings.json +++ b/Aquality.Selenium/src/Aquality.Selenium/Resources/settings.json @@ -8,7 +8,12 @@ "chrome": { "webDriverVersion": "Latest", "capabilities": { - "enableVNC": true + "enableVNC": true, + "loggingPrefs": { + "driver": "INFO", + "server": "OFF", + "browser": "FINE" + } }, "options": { "intl.accept_languages": "en",