Improve documentation on use of WebDriverProvider to prevent error 'WebDriver has not been found for this thread.'

Description

When using the webDriver in the pages classes as follows:

public class Home extends AbstractPage {

private final WebDriver driver;

public Home(WebDriverProvider driverProvider) {
super(driverProvider);
this.driver = driverProvider.get();
}

public void open() {
get("http://localhost:8080/bignibou/");
manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
}

public void enterDetails(String email, String status, String password) {
driver.findElement(By.name("member.email")).sendKeys(email);
driver.findElement(By.name("member.status")).sendKeys(status);
driver.findElement(By.name("member.password")).sendKeys(password);
}

public void doRegister() {
driver.findElement(By.name("member.doRegister")).submit();
}

One get the following error:
WebDriver has not been found for this thread.
Please verify you are using the correct WebDriverProvider, with the appropriate credentials if using remote access, e.g. to SauceLabs: -DSAUCE_USERNAME=xxxxxx -DSAUCE_ACCESS_KEY=xxx-xxxx-xxxx-xxxx-xxx

Instead one has to use the webDriverProvider as follows:

public class Home extends AbstractPage {

private WebDriverProvider driverProvider;

public Home(WebDriverProvider driverProvider) {
super(driverProvider);
this.driverProvider = driverProvider;
}

public void doRegister() {
driverProvider.get().findElement(By.name("member.doRegister")).submit();
}

}

Maybe the error message could be more explicit.

Assignee

Unassigned

Reporter

Julien Martin

Labels

None

Components

Fix versions

Priority

Minor
Configure