0

I am beginner in Selenium. Tried with basic webpage open, timeout and close with the below code. But the browser is closing without performing wait(). What could be the problem here. ?

WebDriver SDriver = new ChromeDriver();
    SDriver.get("https://www.google.co.in");


        SDriver.manage().window().maximize();
        SDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

        SDriver.close();
sudhakar
  • 37
  • 1
  • 1
  • 7
  • Pls read about waits first. Also search SO well. There are lot of posts where this is explained. http://stackoverflow.com/questions/34422661/selenium-implicitlywait-not-working – Makjb lh Feb 28 '16 at 16:42

1 Answers1

0

An implicit wait only occurs if you're searching for an element, but can't find it. So if you're searching for something, and you set implicit wait to 10 seconds, it'll wait a maximum of 10 seconds before it cancels, since it didn't find the element in time.

What you meant to use was an explicit wait, which is, in your scenario, essentially similar to calling Thread.sleep().

Henry98
  • 571
  • 2
  • 12
  • Basically what i tried was, to open a page, wait for few seconds and close the browser. Will Explicit wait help that ? – sudhakar Feb 28 '16 at 05:30