title: TestNg Selenide. No webdriver is bound to current thread
body: <p>I am setting up a project for spasuk in parallel. For more flexibility, I decided to use testng. Faced the problem that the tests do not see the web driver. Have the following error</p>
  <pre><code>java.lang.IllegalStateException: No webdriver is bound to current thread: 14. You need to call open(url) first.
  </code></pre>
  <p>Below are the pom file one of the test classes so that it would be clear how it is called, the method that initializes the browser and one of the suites (they are the same in structure, they just refer to different packages)</p>
  <p>Although browser was opened.</p>
  <p>POM.xml file:</p>
  <pre><code>    &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
           xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
           xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.app&lt;/groupId&gt;
      &lt;artifactId&gt;e2e-ui-cashier&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
      &lt;properties&gt;
          &lt;maven.compiler.target&gt;1.8&lt;/maven.compiler.target&gt;
          &lt;maven.compiler.source&gt;1.8&lt;/maven.compiler.source&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
  
          &lt;maven-surefire-plugin.version&gt;2.21.0&lt;/maven-surefire-plugin.version&gt;
          &lt;junit-platform-surefire-provider.version&gt;1.3.1&lt;/junit-platform-surefire-provider.version&gt;
          &lt;aspectj.version&gt;1.8.10&lt;/aspectj.version&gt;
  
          &lt;junit.jupiter.version&gt;5.6.2&lt;/junit.jupiter.version&gt;
          &lt;junit.jupiter.engine.version&gt;5.3.1&lt;/junit.jupiter.engine.version&gt;
          &lt;junit.jupiter.api.version&gt;5.4.2&lt;/junit.jupiter.api.version&gt;
  
          &lt;selenide.version&gt;5.2.7&lt;/selenide.version&gt;
  
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.codeborne&lt;/groupId&gt;
              &lt;artifactId&gt;selenide&lt;/artifactId&gt;
              &lt;version&gt;${selenide.version}&lt;/version&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;io.qameta.allure&lt;/groupId&gt;
              &lt;artifactId&gt;allure-selenide&lt;/artifactId&gt;
              &lt;version&gt;2.12.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.rest-assured&lt;/groupId&gt;
              &lt;artifactId&gt;json-path&lt;/artifactId&gt;
              &lt;version&gt;3.1.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.rest-assured&lt;/groupId&gt;
              &lt;artifactId&gt;xml-path&lt;/artifactId&gt;
              &lt;version&gt;3.1.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.rest-assured&lt;/groupId&gt;
              &lt;artifactId&gt;json-schema-validator&lt;/artifactId&gt;
              &lt;version&gt;3.1.0&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.rest-assured&lt;/groupId&gt;
              &lt;artifactId&gt;rest-assured&lt;/artifactId&gt;
              &lt;version&gt;3.1.0&lt;/version&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.17&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
              &lt;version&gt;1.16.20&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;io.github.artsok&lt;/groupId&gt;
              &lt;artifactId&gt;rerunner-jupiter&lt;/artifactId&gt;
              &lt;version&gt;LATEST&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.aeonbits.owner&lt;/groupId&gt;
              &lt;artifactId&gt;owner&lt;/artifactId&gt;
              &lt;version&gt;1.0.10&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.github.bonigarcia&lt;/groupId&gt;
              &lt;artifactId&gt;webdrivermanager&lt;/artifactId&gt;
              &lt;version&gt;3.8.0&lt;/version&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.testng&lt;/groupId&gt;
              &lt;artifactId&gt;testng&lt;/artifactId&gt;
              &lt;version&gt;7.1.0&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.testng&lt;/groupId&gt;
              &lt;artifactId&gt;testng&lt;/artifactId&gt;
              &lt;version&gt;7.1.0&lt;/version&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-testng --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.qameta.allure&lt;/groupId&gt;
              &lt;artifactId&gt;allure-testng&lt;/artifactId&gt;
              &lt;version&gt;2.13.3&lt;/version&gt;
          &lt;/dependency&gt;
  
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                  &lt;version&gt;${maven-surefire-plugin.version}&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;includes&gt;
                          &lt;include&gt;**/*Test.java&lt;/include&gt;
                      &lt;/includes&gt;
                      &lt;useSystemClassLoader&gt;false&lt;/useSystemClassLoader&gt;
                      &lt;testFailureIgnore&gt;false&lt;/testFailureIgnore&gt;
                      &lt;argLine&gt;
                          -javaagent:&quot;${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar&quot;
                      &lt;/argLine&gt;
                      &lt;systemProperties&gt;
                          &lt;property&gt;
                              &lt;name&gt;junit.jupiter.extensions.autodetection.enabled&lt;/name&gt;
                              &lt;value&gt;true&lt;/value&gt;
                          &lt;/property&gt;
                      &lt;/systemProperties&gt;
                      &lt;systemPropertyVariables&gt;
                          &lt;propertyName&gt;allure-results&lt;/propertyName&gt;
                          &lt;allure.results.directory&gt;target/allure-results&lt;/allure.results.directory&gt;
                          &lt;allure.link.issue.pattern&gt;https://arammeem.atlassian.net/browse/{}&lt;/allure.link.issue.pattern&gt;
                      &lt;/systemPropertyVariables&gt;
                      &lt;properties&gt;
                          &lt;property&gt;
                              &lt;name&gt;suitethreadpoolsize&lt;/name&gt;
                              &lt;value&gt;2&lt;/value&gt;
                          &lt;/property&gt;
                          &lt;property&gt;
                              &lt;name&gt;parallel&lt;/name&gt;
                              &lt;value&gt;suites&lt;/value&gt;
                          &lt;/property&gt;
                          &lt;property&gt;
                              &lt;name&gt;dataproviderthreadcount&lt;/name&gt;
                              &lt;value&gt;2&lt;/value&gt;
                          &lt;/property&gt;
  
                      &lt;/properties&gt;
                      &lt;suiteXmlFiles&gt;
                          &lt;suiteXmlFile&gt;src/test/resources/suite1.xml&lt;/suiteXmlFile&gt;
                          &lt;suiteXmlFile&gt;src/test/resources/suite2.xml&lt;/suiteXmlFile&gt;
  &lt;!--                        &lt;suiteXmlFile&gt;src/test/resources/suite3.xml&lt;/suiteXmlFile&gt;--&gt;
  &lt;!--                        &lt;suiteXmlFile&gt;src/test/resources/suite4.xml&lt;/suiteXmlFile&gt;--&gt;
                      &lt;/suiteXmlFiles&gt;
  
                  &lt;/configuration&gt;
                  &lt;dependencies&gt;
                      &lt;!--                    &lt;dependency&gt;--&gt;
                      &lt;!--                        &lt;groupId&gt;org.junit.platform&lt;/groupId&gt;--&gt;
                      &lt;!--                        &lt;artifactId&gt;junit-platform-surefire-provider&lt;/artifactId&gt;--&gt;
                      &lt;!--                        &lt;version&gt;${junit-platform-surefire-provider.version}&lt;/version&gt;--&gt;
                      &lt;!--                    &lt;/dependency&gt;--&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
                          &lt;artifactId&gt;aspectjweaver&lt;/artifactId&gt;
                          &lt;version&gt;${aspectj.version}&lt;/version&gt;
                      &lt;/dependency&gt;
                  &lt;/dependencies&gt;
              &lt;/plugin&gt;
  
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  
  </code></pre>
  <p>Test class example:</p>
  <pre><code>// ~ Copyright © 2019 Aram Meem Company Limited. All Rights Reserved.
  
  package pages.thread_1;
  
  import io.qameta.allure.Description;
  import io.qameta.allure.Issue;
  import org.testng.annotations.BeforeMethod;
  import org.testng.annotations.Test;
  import steps.*;
  import steps.modalPagesSteps.*;
  import utils.BaseTest;
  import utils.annotations.Bug;
  import utils.enums.OrderStatus;
  import utils.enums.Settlement;
  
  import static com.codeborne.selenide.Selenide.sleep;
  import static core.TestStepLogger.logPreconditionStep;
  import static core.TestStepLogger.logStep;
  import static steps.HelperSteps.openSecondTab;
  import static steps.HelperSteps.resizeBrowserWindow;
  import static utils.enums.Locale.AR;
  import static utils.enums.Locale.EN;
  import static utils.enums.Localization.VALID_NUMBER;
  import static utils.enums.NotificationMessages.MERCHANT_ORDER_REFERENCE_ALREADY_IN_USE;
  import static utils.enums.PageTitles.*;
  
  
  public class BookADeliveryOrdersTest extends BaseTest {
  
      @BeforeMethod(alwaysRun=true)
      public void goToLoginPage() {
          logPreconditionStep(1, &quot;Open 'Login' page&quot;);
          configure();
  
          logPreconditionStep(2, &quot;Check that 'email' and 'password' placeholders are displayed&quot;);
          loginPageSteps.checkThatEmailAndPasswordPlaceholdersAreDisplayed();
  
          logPreconditionStep(3, &quot;Enter valid credentials&quot;);
          loginPageSteps.enterValidCredentials(merUser2);
  
          logPreconditionStep(4, &quot;Press 'OK' on the Warning notification&quot;);
          warningModalPageSteps.checkThatSoundNotificationWarningIsDisplayedAndClickOk();
  
          logPreconditionStep(5, &quot;Check that 'NEW ORDERS' title appears&quot;);
          titlePageSteps.pageTitleShouldHaveText(MAIN);
      }
  
      @Test
      @Description(&quot;Orders creation functionality verification&quot;)
      public void ordersCreationFunctionalityVerification() {
          logStep(1, &quot;Switch POS to &quot; + pos1.getName());
          headerPageSteps.setAndCheckPOS(pos1);
  
          logStep(2, &quot;Go to 'BOOK A DELIVERY' page&quot;);
          mainPageSteps.clickBookADeliveryButton();
          titlePageSteps.pageTitleShouldHaveText(BOOK_A_DELIVERY);
  
          logStep(3, &quot;Fill all mandatory fields&quot;);
          bookADeliveryPageSteps.fillAllMandatoryFields();
  
          logStep(4, &quot;Press 'Book order' button&quot;);
          bookADeliveryPageSteps.clickBtnDeliveryOrder();
  
          logStep(5, &quot;Click 'Confirm order' button&quot;);
          confirmOrderModalPageStep.clickConfirmOrderBtn();
  
          logStep(6, &quot;Check confirmation message&quot;);
          notificationModalPageSteps.createOrderMessageShouldBeEnglishDisplayed();
      }
  }
  </code></pre>
  <p>Configuration:</p>
  <pre><code>
          public void configure() {
          System.setProperty(&quot;selenide.browser&quot;, &quot;chrome&quot;);
  
          ChromeDriverManager.chromedriver().version(testProp.chromeDriverVersion()).setup();
  
          SelenideLogger.addListener(testProp.selenideListener(), new AllureSelenide().screenshots(true).savePageSource(false));
  
          System.out.println(&quot;DDDDDDDDDDDDDDDDDDDDDDDD&quot;);
  
          Configuration.browserSize = testProp.browserSize();
  
          Configuration.timeout = testProp.timeout();
  
          Configuration.headless = testProp.headless();
  
          clearBrowserCache();
  
          BASE_LOCALE = Locale.EN;
  
          Selenide.open(testCred.BASE_URL());
      }
  </code></pre>
  <p>One of the suites:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;!DOCTYPE suite SYSTEM &quot;https://testng.org/testng-1.0.dtd&quot; &gt;
  &lt;!--        verbose=&quot;1&quot; parallel=&quot;false&quot;--&gt;
  &lt;suite name=&quot;Suite1&quot; parallel=&quot;tests&quot; verbose=&quot;2&quot;&gt;
  &lt;test name=&quot;Regression1&quot; &gt;
  &lt;packages&gt;
  &lt;package name=&quot;pages.thread_1&quot;&gt;&lt;/package&gt;
   &lt;/packages&gt;
  &lt;/test&gt;
  &lt;/suite&gt;
  </code></pre>