Skip to content

Instantly share code, notes, and snippets.

@NickBaynham
Created March 3, 2020 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NickBaynham/7031108adeb78258fe0ed981fb0f42d2 to your computer and use it in GitHub Desktop.
Save NickBaynham/7031108adeb78258fe0ed981fb0f42d2 to your computer and use it in GitHub Desktop.
A workflow that uses Page Objects with Auto Discovery that can be used in tests as modular components
package selfHealingExamples.workflows;
import framework.pageObjects.RegistrationFormAutoDiscovery;
import io.nickbaynham.automation.selfhealing.BrowserNotAvailableException;
import io.nickbaynham.automation.selfhealing.controllers.ElementNotFoundException;
import org.openqa.selenium.WebDriver;
public class RegistrationDiscoveryWorkflow {
private WebDriver driver;
public RegistrationDiscoveryWorkflow(WebDriver driver) {
this.driver = driver;
}
public boolean completeRegistration(
String firstName,
String lastName,
String username,
String city,
String state,
String zip,
boolean acceptTerms
) throws BrowserNotAvailableException, ElementNotFoundException {
RegistrationFormAutoDiscovery registration = new RegistrationFormAutoDiscovery(driver);
registration.goToPage();
registration.enterText("First Name", firstName);
registration.enterText("Last Name", lastName);
registration.enterText("Username", username);
registration.enterText("City", city);
registration.enterText("State", state);
registration.enterText("Zip", zip);
registration.clickCheckBox("Accept Terms");
registration.clickButton("Register");
return "Self Healing Test Page".equals(registration.getTitle());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment