title: Set Priority in Selenium WebDriver
body: <p>I am working with selenium webdriver. I have written 2 methods </p>
  
  <p>1) addUserWithOutFirstName()
  2) addUserWithOutGeneratingLicenceKey()</p>
  
  <p>Initially the priority was set 0 for addUserWithOutFirstName() and 1 for addUserWithOutGeneratingLicenceKey(). Now i want to change the priority of addUserWithOutGeneratingLicenceKey() as 0 and addUserWithOutFirstName() as 1. I have changed the priorities. But still addUserWithOutFirstName() is getting executed first.</p>
  
  <p>Don't know what is the problem. Can anybody help?</p>
  
  <p>/* Add user without generating licence key */</p>
  
  <pre><code>@Test(priority=0)
  public void addUserWithOutGeneratingLicenceKey() throws BiffException, IOException,InterruptedException {
  
      try {
          int successfullLoginRowNumber = 6;
          Thread.sleep(2000);
          WebElement username = webElement("VAR_EMAIL");
          username.clear();
          username.sendKeys(getCellContent(0, successfullLoginRowNumber));
          Thread.sleep(2000);
          WebElement password = webElement("VAR_PASSWORD");
          password.clear();
          password.sendKeys(getCellContent(1, successfullLoginRowNumber));
          Thread.sleep(2000);
          WebElement signInButton = webElement("VAR_SIGNINBUTTON");
          signInButton.click();
          Thread.sleep(2000);
          input(properties.getProperty("VAR_ADDUSERDETAILS"));
          int emptyLicenceKeyRowNumber = 1;
          WebElement firstName = webElement("VAR_FIRSTNAME");
          firstName.clear();
          firstName.sendKeys(getCellContent(0, emptyLicenceKeyRowNumber));
          Thread.sleep(1000);
          WebElement lastName = webElement("VAR_LASTNAME");
          lastName.clear();
          lastName.sendKeys(getCellContent(1, emptyLicenceKeyRowNumber));
          Thread.sleep(1000);
          WebElement email = webElement("VAR_ADDUSEREMAIL");
          email.clear();
          email.sendKeys(getCellContent(2, emptyLicenceKeyRowNumber));
          Thread.sleep(1000);
          WebElement countryCode = webElement("VAR_COUNTRYCODE");
          countryCode.clear();
          countryCode.sendKeys(getCellContent(3, emptyLicenceKeyRowNumber));
          Thread.sleep(1000);
          WebElement phoneNumber = webElement("VAR_PHONENUMBER");
          phoneNumber.clear();
          phoneNumber.sendKeys(getCellContent(4, emptyLicenceKeyRowNumber));
          Thread.sleep(1000);
          List&lt;WebElement&gt; allUserTypes = driver.findElements(By.xpath("//*[@id='add_user']/div/div[5]/div[1]/div/div/div/div/label"));
          for (WebElement ele : allUserTypes) {
              String userType = ele.getText();
              String user= getCellContent(5, emptyLicenceKeyRowNumber);
              if (userType == user) {
                  ele.click();
                  break;
              }
          }
          Thread.sleep(1000);
          List&lt;WebElement&gt; allCountry = driver.findElements(By.xpath("//*[@id='add_user']/div/div[5]/div[2]/div/div/div/label"));
          for (WebElement ele : allCountry) {
              String country = ele.getText();
              String cntry= getCellContent(6, emptyLicenceKeyRowNumber);
              if (country == cntry) {
                  ele.click();
                  break;
              }
          }
          Thread.sleep(1000);
          WebElement organization = webElement("VAR_ORGANIZATION");
          organization.clear();
          organization.sendKeys(getCellContent(7, emptyLicenceKeyRowNumber));
          Thread.sleep(1000);
          List&lt;WebElement&gt; allDomains = driver.findElements(By.xpath("//*[@id='add_user']/div/div[7]/div[2]/div/div/div/label"));
          for (WebElement ele : allDomains) {
              String domain = ele.getText();
              String dmn= getCellContent(8, emptyLicenceKeyRowNumber);
              if (domain == dmn) {
                  ele.click();
                  break;
              }
          }
          Thread.sleep(1000);
          WebElement licenceKey = webElement("VAR_LICENCEKEY");
          licenceKey.click();
          Thread.sleep(1000);
          if (driver.findElement(By.className("disabled")) != null) {
              testresultdata.put("14", new Object[] { 13d, "Add User","Add User without generating licence key","Should not be possible to add user","Should not be possible to add user", "Pass" });
          }
      } catch (Exception e) {
          if (driver.findElement(By.className("disabled")) == null) {
              testresultdata.put("14", new Object[] { 13d, "Add User","Add User without generating licence key","Should not be possible to add user", "Possible to add user","Fail", e.getMessage() });
          }
      }
  }
  
  
  /* Add user without entering first name */
  
  @Test(priority=1)
  public void addUserWithOutFirstName() throws BiffException, IOException,InterruptedException {
  
      try {
          int successfullLoginRowNumber = 6;
          Thread.sleep(2000);
          WebElement username = webElement("VAR_EMAIL");
          username.clear();
          username.sendKeys(getCellContent(0, successfullLoginRowNumber));
          Thread.sleep(2000);
          WebElement password = webElement("VAR_PASSWORD");
          password.clear();
          password.sendKeys(getCellContent(1, successfullLoginRowNumber));
          Thread.sleep(2000);
          WebElement signInButton = webElement("VAR_SIGNINBUTTON");
          signInButton.click();
          Thread.sleep(2000);
          input(properties.getProperty("VAR_ADDUSERDETAILS"));
          int emptyFirstNameRowNumber = 2;
          WebElement addUser = webElement("VAR_ADDUSER");
          addUser.click();
          Thread.sleep(2000);
          WebElement firstName = webElement("VAR_FIRSTNAME");
          firstName.clear();
          firstName.sendKeys(getCellContent(0, emptyFirstNameRowNumber));
          Thread.sleep(1000);
          WebElement lastName = webElement("VAR_LASTNAME");
          lastName.clear();
          lastName.sendKeys(getCellContent(1, emptyFirstNameRowNumber));
          Thread.sleep(1000);
          WebElement email = webElement("VAR_ADDUSEREMAIL");
          email.clear();
          email.sendKeys(getCellContent(2, emptyFirstNameRowNumber));
          Thread.sleep(1000);
          WebElement countryCode = webElement("VAR_COUNTRYCODE");
          countryCode.clear();
          countryCode.sendKeys(getCellContent(3, emptyFirstNameRowNumber));
          Thread.sleep(1000);
          WebElement phoneNumber = webElement("VAR_PHONENUMBER");
          phoneNumber.clear();
          phoneNumber.sendKeys(getCellContent(4, emptyFirstNameRowNumber));
          Thread.sleep(1000);
          List&lt;WebElement&gt; allUserTypes = driver.findElements(By.xpath("//*[@id='add_user']/div/div[5]/div[1]/div/div/div/div/label"));
          for (WebElement ele : allUserTypes) {
              String userType = ele.getText();
              String user= getCellContent(5, emptyFirstNameRowNumber);
              if (userType.equals(user)) {
                  ele.click();
                  break;
              }
          }
          Thread.sleep(1000);
          List&lt;WebElement&gt; allCountry = driver.findElements(By.xpath("//*[@id='add_user']/div/div[5]/div[2]/div/div/div/label"));
          for (WebElement ele : allCountry) {
              String country = ele.getText();
              String cntry= getCellContent(6, emptyFirstNameRowNumber);
              if (country.equals(cntry)) {
                  ele.click();
                  break;
              }
          }
          Thread.sleep(1000);
          WebElement organization = webElement("VAR_ORGANIZATION");
          organization.clear();
          organization.sendKeys(getCellContent(7, emptyFirstNameRowNumber));
          Thread.sleep(1000);
          List&lt;WebElement&gt; allDomains = driver.findElements(By.xpath("//*[@id='add_user']/div/div[7]/div[2]/div/div/div/label"));
          for (WebElement ele : allDomains) {
              String domain = ele.getText();
              String dmn= getCellContent(8, emptyFirstNameRowNumber);
              if (domain.equals(dmn)) {
                  ele.click();
                  break;
              }
          }
          Thread.sleep(1000);
          WebElement licenceKey = webElement("VAR_LICENCEKEY");
          licenceKey.click();
          Thread.sleep(1000);
          if (driver.findElement(By.xpath("//*[@id='add_user']/div/div[9]/div/div")) != null) {
              testresultdata.put("14", new Object[] { 13d, "Add User","Add User without entering first name","Should not be possible to add user","Should not be possible to add user", "Pass" });
          }
      } catch (Exception e) {
          if (driver.findElement(By.xpath("//*[@id='add_user']/div/div[9]/div/div")) == null) {
              testresultdata.put("14", new Object[] { 13d, "Add User","Add User without entering first name","Should not be possible to add user", "Possible to add user","Fail", e.getMessage() });
          }
      }
  }
  </code></pre>