I have some code with the following structure in Eclipse:
package automationFramework;
import java.util.List;
import org.openqa.selenium.support.ui.Select;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class FirefoxDropDown {
public static void main(String[] args) throws InterruptedException {
// Create a new instance of the Firefox driver
System.setProperty("webdriver.gecko.driver", "/home/gradulescu/Documents/Eclipse project/geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
// Storing the Application URL in the String variable
String url= "http://toolsqa.wpengine.com/automation-practice-form/";
driver.get(url);
//Launch the Online Store Website
Select oSdropDown = new Select((WebElement)driver.findElement(By.id("continents")));
oSdropDown.selectByIndex(1);
Thread.sleep(100);
oSdropDown.selectByVisibleText("Africa");
Thread.sleep(100);
List<WebElement> oSize = oSdropDown.getOptions();
int size = oSize.size();
for(int i=0;i<size;i++)
{
String sValue = oSdropDown.getOptions().get(i).getText();
System.out.println(sValue);
}
driver.quit();
}
}
My expectation would be that after the first code ran, 10 seconds to be waited and then the second code and some other 10 seconds. But actually the compiler runs command after command without waiting the 10 seconds I have set.
Is there any mandatory condition for it to work?
Thank you!