PageObjectModel/src/tests/waits/ExplicitWaitTests.java

62 lines
2.0 KiB
Java

package tests.waits;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import pages.waits.WaitingStrategiesPage;
public class ExplicitWaitTests
{
public static void main(String[] args)
{
// Specify path to WebDriver:
System.setProperty("webdriver.gecko.driver", "/snap/bin/geckodriver");
// Launch browser and navigate to test page:
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("https://ramoncaballero.dev/sdet/selenium-webdriver/playgrounds/");
// Instantiate the page model:
WaitingStrategiesPage page = new WaitingStrategiesPage(driver);
// Perform actions on the page:
page.clickOnAccordionItem();
// ======================================================================================== //
//
// DISABLED INPUT
//
// ======================================================================================== //
page.clickEnableOrDisableButton();
page.waitForEnabledOrDisabledInputToBeClickable(1000); // Wait for the JavaScript to enable the input.
page.setEnabledOrDisabledInput("Explicit Wait with disabled elements");
// ======================================================================================== //
//
// HIDDEN INPUT
//
// ======================================================================================== //
page.clickShowOrHideButton();
page.waitForShownOrHiddenInputToBeClickable(1000); // Wait for the JavaScript to show the input.
page.setShownOrHiddenInput("Explicit Wait with hidden elements");
// ======================================================================================== //
//
// DYNAMIC INPUT
//
// ======================================================================================== //
page.clickAddOrRemoveButton();
page.waitForDynamicInputToBePresent(1000);
page.setDynamicInput("Explicit Wait with dynamic elements");
//
// This is commented out so you can actually see what happened in the web page:
// driver.quit();
}
}