Closed kazurayam closed 2 years ago
I have an idea: add a new class ChromeDriverLaunched, which is a composite of
class ChromeDriverLaunched {
private final ChromeDriver chromeDriver
private Optional<ChromeUserProfile> chromeUserProfile
private Optional<UserDataAccess> instruction
private Optional<DesiredCapabilities> employedDesiredCapabilities
public ChromeDriverLaunched(ChromeDriver driver) {
this.driver = driver
this.chromeUserProfile = Optional.empty()
}
public ChromeDriver getDriver() {
return this.driver
}
public ChromeDriverLaunched setChromeUserProfile(ChromeUserProfile cup) {
this.chromeUserProfile = Optional.of(cup)
return this
}
public Optional<ChromeUserProfile> getChromeUserProfile() {
return this.chromeUserProfile
}
...
}
And most importantly, ChromeDriverFactory.newChromeDirver()
should return an instance of ChromeDriverLaunched
instead of ChromeDriver
.
v0.2.6 supports this
in https://github.com/kazurayam/webdriverfactory/blob/0.2.4/src/main/groovy/com/kazurayam/webdriverfactory/chrome/ChromeDriverFactoryImpl.groovy
there are lines:
These lines are difficult to understand for those you do not know Groovy's Metaprogramming technique.