-
Notifications
You must be signed in to change notification settings - Fork 15
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 #292 from telekom/feature/support-selenium-4
Feature/support selenium 4
- Loading branch information
Showing
62 changed files
with
2,041 additions
and
452 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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
= Access to Chrome dev tools | ||
|
||
[NOTE] | ||
==== | ||
* The following examples are working with Selenium 4 server. If you are using another grid like Selenoid the usage could be different. | ||
* Only Chrome browser supports access to development tools. | ||
==== | ||
|
||
== Emulate geo location | ||
|
||
Examples are based on https://www.selenium.dev/documentation/webdriver/bidirectional/chrome_devtools/. | ||
|
||
.Local webdriver | ||
[source,java] | ||
---- | ||
WebDriver webDriver = WEB_DRIVER_MANAGER.getWebDriver(); | ||
ChromeDriver chromeDriver = WEB_DRIVER_MANAGER | ||
.unwrapWebDriver(webDriver, ChromeDriver.class).get(); | ||
DevTools devTools = chromeDriver.getDevTools(); | ||
devTools.createSession(); | ||
devTools.send(Emulation.setGeolocationOverride( | ||
Optional.of(52.52084), | ||
Optional.of(13.40943), | ||
Optional.of(1))); | ||
webDriver.get("https://my-location.org/"); // page gets the new geo location information | ||
---- | ||
|
||
.Remote webdriver (e.g. of a grid) | ||
[source,java] | ||
---- | ||
WebDriver webDriver = WEB_DRIVER_MANAGER.getWebDriver(); | ||
RemoteWebDriver remoteWebDriver = WEB_DRIVER_MANAGER | ||
.unwrapWebDriver(webDriver, RemoteWebDriver.class).get(); | ||
webDriver = new Augmenter().augment(remoteWebDriver); | ||
DevTools devTools = ((HasDevTools) webDriver).getDevTools(); | ||
devTools.createSession(); | ||
devTools.send(Emulation.setGeolocationOverride( | ||
Optional.of(52.52084), | ||
Optional.of(13.40943), | ||
Optional.of(1))); | ||
webDriver.get("https://my-location.org/"); | ||
---- | ||
|
||
== Basic authentication | ||
|
||
[source,java] | ||
---- | ||
WebDriver webDriver = WEB_DRIVER_MANAGER.getWebDriver(); | ||
WebDriver remoteWebDriver = WEB_DRIVER_MANAGER.unwrapWebDriver(webDriver, RemoteWebDriver.class).get(); | ||
AtomicReference<DevTools> devToolsAtomicReference = new AtomicReference<>(); | ||
remoteWebDriver = new Augmenter() | ||
.addDriverAugmentation( | ||
"chrome", | ||
HasAuthentication.class, | ||
(caps, exec) -> (whenThisMatches, useTheseCredentials) -> { | ||
devToolsAtomicReference.get().createSessionIfThereIsNotOne(); | ||
devToolsAtomicReference.get().getDomains() | ||
.network() | ||
.addAuthHandler(whenThisMatches, useTheseCredentials); | ||
}) | ||
.augment(remoteWebDriver); | ||
DevTools devTools = ((HasDevTools) remoteWebDriver).getDevTools(); | ||
devTools.createSession(); | ||
devToolsAtomicReference.set(devTools); | ||
// Set credentials and call the page with 'basic authentication' protection | ||
((HasAuthentication) remoteWebDriver).register(UsernameAndPassword.of("admin", "admin")); | ||
webDriver.get("https://the-internet.herokuapp.com/basic_auth"); | ||
---- |
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 was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
= Selenium 4 | ||
|
||
include::selenium4/selenium4-common.adoc[leveloffset=+1] | ||
include::selenium4/selenium4-changes.adoc[leveloffset=+1] | ||
include::selenium4/selenium4-cdp.adoc[leveloffset=+1] |
Oops, something went wrong.