Quality Testing

Quality is delighting customers

How to use WebDriverWait for different methods in class in selenium?

How to use WebDriverWait for different methods in class in selenium?

I am getting java.lang.NullPointerException when i declare it in second method as shown below.

public class NewTest {
    
                            public WebDriverWait mywait;

                           void add() throws InterruptedException

                   {             //code

                              mywait= new WebDriverWait(driver,25);

                                 //code

                   }

                             void delete() throws InterruptedException

                  {           //code

                            mywait= new WebDriverWait(driver,25); //here selenium is    giving java.lang.NullPointerException

                                 //code

                   }

          

         

Views: 195

Replies to This Discussion

Use the timeout like provided below - this is for implicit timeout

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

For the implicit time out use provided below

 driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2019   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service