Skip to content

Added restart driver capability#14

Open
dimitrianos wants to merge 1 commit into
anaxdojo:developfrom
dimitrianos:feature/add_restart_driver
Open

Added restart driver capability#14
dimitrianos wants to merge 1 commit into
anaxdojo:developfrom
dimitrianos:feature/add_restart_driver

Conversation

@dimitrianos

Copy link
Copy Markdown

Restart browser is sometimes essential to clean up the environment

@Bean
public WebController getWebController(@Autowired AnaxDriver anaxDriver, @Value("${anax.defaultWaitSeconds:5}") Integer defaultWaitSeconds) throws Exception {
return new WebDriverWebController(anaxDriver.getWebDriver(), defaultWaitSeconds);
return new WebDriverWebController(anaxDriver.getWebDriver(), anaxDriver, defaultWaitSeconds);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dimitrianos pls simplify the signature to new WebDriverWebController(anaxDriver, defaultWaitSeconds) since you can receive the WebDriver from that object - no need to have both of them.

*/
String getPageSource() ;

boolean restart();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add documentation - why restart exists and what it does, how

public AppiumDriverWebController(WebDriver webDriver, long defaultWaitSeconds) {
public AppiumDriverWebController(WebDriver webDriver, AnaxDriver anaxDriver, long defaultWaitSeconds) {
this.driver = webDriver;
this.anaxDriver = anaxDriver;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace this.driver = webDriver with this.driver = anaxDriver.getWebDriver() - much cleaner after you simplify the signature (see first comment)

return null;
}

@Override

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding restart() as implementation to all drivers, consider adding a default on the interface (that returns false) and only implement in WebControllers that can possibly do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants