-
-
Notifications
You must be signed in to change notification settings - Fork 523
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a method to the WebDriverManager instance to retreive a named w…
…ebdriver instance.
- Loading branch information
Showing
3 changed files
with
34 additions
and
1 deletion.
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: 26 additions & 0 deletions
26
serenity-core/src/main/java/net/thucydides/core/webdriver/WebdriverContext.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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package net.thucydides.core.webdriver; | ||
|
||
import org.openqa.selenium.WebDriver; | ||
|
||
public class WebdriverContext { | ||
|
||
private final WebdriverManager webdriverManager; | ||
private final String context; | ||
|
||
public WebdriverContext(WebdriverManager webdriverManager, String context) { | ||
this.webdriverManager = webdriverManager; | ||
this.context = context; | ||
} | ||
|
||
public WebDriver getWebdriver() { | ||
String driverType = webdriverManager.getCurrentDriverName(); | ||
String driverName = driverType + ":" + context; | ||
return webdriverManager.getWebdriver(driverName); | ||
} | ||
|
||
WebDriver getWebdriver(String driverType) { | ||
String driverName = driverType + ":" + context; | ||
return webdriverManager.getWebdriver(driverName); | ||
} | ||
|
||
} |
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