1212import org .openqa .selenium .NoAlertPresentException ;
1313import org .openqa .selenium .OutputType ;
1414import org .openqa .selenium .WebDriver .Navigation ;
15+ import org .openqa .selenium .logging .LogEntries ;
1516import org .openqa .selenium .remote .RemoteWebDriver ;
1617import org .openqa .selenium .support .ui .ExpectedCondition ;
1718
2324import java .util .function .Supplier ;
2425
2526public class Browser implements IApplication {
27+
2628 private final RemoteWebDriver webDriver ;
2729 private final ITimeoutConfiguration timeouts ;
28- private Duration timeoutImpl ;
2930 private final IBrowserProfile browserProfile ;
3031 private final IConditionalWait conditionalWait ;
3132 private final ILocalizationManager localizationManager ;
3233 private final ILocalizedLogger localizedLogger ;
3334
35+ private Duration implicitTimeout ;
3436
3537 public Browser (RemoteWebDriver remoteWebDriver ) {
3638 conditionalWait = AqualityServices .getConditionalWait ();
@@ -39,8 +41,8 @@ public Browser(RemoteWebDriver remoteWebDriver) {
3941 this .browserProfile = AqualityServices .getBrowserProfile ();
4042 this .timeouts = AqualityServices .get (ITimeoutConfiguration .class );
4143 webDriver = remoteWebDriver ;
42- this .timeoutImpl = timeouts .getImplicit ();
43- getDriver ().manage ().timeouts ().implicitlyWait (timeoutImpl .getSeconds (), TimeUnit .SECONDS );
44+ this .implicitTimeout = timeouts .getImplicit ();
45+ getDriver ().manage ().timeouts ().implicitlyWait (implicitTimeout .getSeconds (), TimeUnit .SECONDS );
4446 setPageLoadTimeout (timeouts .getPageLoad ());
4547 setScriptTimeout (timeouts .getScript ());
4648 }
@@ -161,7 +163,7 @@ public void setImplicitWaitTimeout(Duration timeout) {
161163 localizedLogger .debug ("loc.browser.implicit.timeout" , timeout .getSeconds ());
162164 if (!timeout .equals (getImplicitWaitTimeout ())) {
163165 getDriver ().manage ().timeouts ().implicitlyWait (timeout .getSeconds (), TimeUnit .SECONDS );
164- timeoutImpl = timeout ;
166+ implicitTimeout = timeout ;
165167 }
166168 }
167169
@@ -201,6 +203,15 @@ public byte[] getScreenshot() {
201203 return getDriver ().getScreenshotAs (OutputType .BYTES );
202204 }
203205
206+ /**
207+ * Gets logs from WebDriver.
208+ * @param logKind Type of logs {@link org.openqa.selenium.logging.LogType}
209+ * @return Storage of LogEntries.
210+ */
211+ public LogEntries getLogs (final String logKind ) {
212+ return getDriver ().manage ().logs ().get (logKind );
213+ }
214+
204215 /**
205216 * Executes JS (jQuery) script asynchronous.
206217 *
@@ -350,6 +361,6 @@ public final BrowserName getBrowserName() {
350361 }
351362
352363 private Duration getImplicitWaitTimeout () {
353- return timeoutImpl ;
364+ return implicitTimeout ;
354365 }
355366}
0 commit comments