JBehave
  1. JBehave
  2. JBEHAVE-885

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

    Details

    • Type: Improvement Improvement
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: web-3.6
    • Component/s: Documentation
    • Labels:
      None
    • Number of attachments :
      2

      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.

      1. Home.java
        0.9 kB
        Julien Martin
      2. SpringWebStories.java
        2 kB
        Julien Martin

        Activity

        Mauro Talevi made changes -
        Field Original Value New Value
        Summary 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 Improve documentation on use of WebDriverProvider to prevent error 'WebDriver has not been found for this thread.'
        Fix Version/s web-3.6 [ 18388 ]
        Affects Version/s web-3.5.5 [ 18692 ]
        Component/s Documentation [ 11085 ]
        Component/s Spring Support [ 14534 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Julien Martin
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: