-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from aquality-automation/enhancement/use-nati…
…ve-open-new-tab-function [Enhancement] Use native function to open new tab
- Loading branch information
Showing
5 changed files
with
125 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 14 additions & 12 deletions
26
src/main/java/aquality/selenium/browser/BrowserNavigation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,55 @@ | ||
package aquality.selenium.browser; | ||
|
||
import aquality.selenium.core.localization.ILocalizedLogger; | ||
import org.openqa.selenium.WebDriver.Navigation; | ||
import org.openqa.selenium.remote.RemoteWebDriver; | ||
|
||
import java.net.URL; | ||
|
||
class BrowserNavigation implements Navigation { | ||
/** | ||
* Browser navigation wrapper with localized logging. | ||
*/ | ||
public class BrowserNavigation implements Navigation { | ||
|
||
private final RemoteWebDriver driver; | ||
private final ILocalizedLogger logger; | ||
|
||
BrowserNavigation(RemoteWebDriver driver){ | ||
protected BrowserNavigation(RemoteWebDriver driver, ILocalizedLogger logger){ | ||
this.driver = driver; | ||
this.logger = logger; | ||
} | ||
|
||
@Override | ||
public void back() { | ||
infoLoc("loc.browser.back"); | ||
getDriver().navigate().back(); | ||
driver.navigate().back(); | ||
} | ||
|
||
@Override | ||
public void forward() { | ||
infoLoc("loc.browser.forward"); | ||
getDriver().navigate().forward(); | ||
driver.navigate().forward(); | ||
} | ||
|
||
@Override | ||
public void to(String s) { | ||
infoLoc("loc.browser.navigate", s); | ||
getDriver().navigate().to(s); | ||
driver.navigate().to(s); | ||
} | ||
|
||
@Override | ||
public void to(URL url) { | ||
infoLoc("loc.browser.navigate", url); | ||
getDriver().navigate().to(url); | ||
driver.navigate().to(url); | ||
} | ||
|
||
@Override | ||
public void refresh() { | ||
infoLoc("loc.browser.refresh"); | ||
getDriver().navigate().refresh(); | ||
} | ||
|
||
private RemoteWebDriver getDriver() { | ||
return driver; | ||
driver.navigate().refresh(); | ||
} | ||
|
||
private void infoLoc(String key, Object... args) { | ||
AqualityServices.getLocalizedLogger().info(key, args); | ||
logger.info(key, args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters