Java Code Examples for org.openqa.selenium.support.PageFactory#initElements()

The following examples show how to use org.openqa.selenium.support.PageFactory#initElements() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WordPressBlogTestsWithPageObject.java    From Selenium-WebDriver-3-Practical-Guide-Second-Edition with MIT License 6 votes vote down vote up
@Test (dependsOnMethods = "testEditPost")
public void testDeletePost() {
    AdminLoginPage loginPage =
            PageFactory.initElements(driver, AdminLoginPage.class);
    AllPostsPage allPostsPage = loginPage.login(username, password);
    allPostsPage.deleteAPost("Editing Post using PageObjects");
}
 
Example 2
Source File: HomePagePageFactory.java    From qashowcase with GNU General Public License v3.0 5 votes vote down vote up
public HomePagePageFactory(WebDriver driver) {
    this.driver = driver;
    this.driverWait = new WebDriverWait(driver, ScriptBase.DEFAULT_WEB_DRIVER_WAIT);
    this.driverJSExecutor = (JavascriptExecutor) driver;

    PageFactory.initElements(driver, this);
}
 
Example 3
Source File: LogoutPage.java    From Spring with Apache License 2.0 4 votes vote down vote up
public static LogoutPage to(WebDriver driver) {
	driver.get("http://localhost:8080/logout");
	return PageFactory.initElements(driver, LogoutPage.class);
}
 
Example 4
Source File: LoginPageStep3.java    From Mastering-Selenium-WebDriver-3.0-Second-Edition with MIT License 4 votes vote down vote up
public LoginPageStep3() throws Exception {
    PageFactory.initElements(DriverBase.getDriver(), this);
}
 
Example 5
Source File: IndexPage.java    From Spring with Apache License 2.0 4 votes vote down vote up
public static <T> T to(WebDriver driver, Class<T> page) {
	driver.get("http://localhost:8080/");
	return (T) PageFactory.initElements(driver, page);
}
 
Example 6
Source File: AdminLoginPageUsingLoadableComponent.java    From Selenium-WebDriver-3-Practical-Guide-Second-Edition with MIT License 4 votes vote down vote up
public AdminLoginPageUsingLoadableComponent(WebDriver driver) {
    this.driver = driver;
    PageFactory.initElements(driver, this);
}
 
Example 7
Source File: IndexPage.java    From Spring with Apache License 2.0 4 votes vote down vote up
public static <T> T to(WebDriver driver, Class<T> page) {
	driver.get("http://localhost:8080/");
	return (T) PageFactory.initElements(driver, page);
}
 
Example 8
Source File: IndexPage.java    From Spring with Apache License 2.0 4 votes vote down vote up
public IndexPage transfer(double amount) {
	this.amount.sendKeys(String.valueOf(amount));
	this.submit.click();
	return PageFactory.initElements(this.driver, IndexPage.class);
}
 
Example 9
Source File: GuineaPigPage.java    From demo-java with MIT License 4 votes vote down vote up
public GuineaPigPage(WebDriver driver) {
    this.driver = driver;
    PageFactory.initElements(driver, this);
}
 
Example 10
Source File: AllPostsPage.java    From Selenium-WebDriver-3-Practical-Guide-Second-Edition with MIT License 4 votes vote down vote up
public void createANewPost(String title, String description) {
    addNewPost.click();
    AddNewPostPage newPost = PageFactory.initElements(driver,
            AddNewPostPage.class);
    newPost.addNewPost(title, description);
}
 
Example 11
Source File: LoginPageStep2.java    From Mastering-Selenium-WebDriver-3.0-Second-Edition with MIT License 4 votes vote down vote up
public LoginPageStep2(WebDriver driver) {
    PageFactory.initElements(driver, this);
}
 
Example 12
Source File: IndexPage.java    From Spring with Apache License 2.0 4 votes vote down vote up
public IndexPage transfer(double amount) {
	this.amount.sendKeys(String.valueOf(amount));
	this.submit.click();
	return PageFactory.initElements(this.driver, IndexPage.class);
}
 
Example 13
Source File: IndexPage.java    From Spring with Apache License 2.0 4 votes vote down vote up
public static <T> T to(WebDriver driver, Class<T> page) {
	driver.get("http://localhost:8080/");
	return (T) PageFactory.initElements(driver, page);
}
 
Example 14
Source File: SauceDemoNavigation.java    From demo-java with MIT License 4 votes vote down vote up
public InventoryPage getInventoryPage() {
    InventoryPage inventoryPage = new InventoryPage();
    PageFactory.initElements(driver, inventoryPage);
    return inventoryPage;
}
 
Example 15
Source File: IndexPage.java    From Spring with Apache License 2.0 4 votes vote down vote up
public IndexPage(WebDriver webDriver) {
	this.driver = webDriver;
	PageFactory.initElements(webDriver, this);
}
 
Example 16
Source File: IndexPage.java    From Spring with Apache License 2.0 4 votes vote down vote up
public IndexPage(WebDriver webDriver) {
	this.driver = webDriver;
	PageFactory.initElements(webDriver, this);
}
 
Example 17
Source File: IndexPage.java    From Spring with Apache License 2.0 4 votes vote down vote up
public IndexPage(WebDriver webDriver) {
	this.driver = webDriver;
	PageFactory.initElements(webDriver, this);
}
 
Example 18
Source File: IndexPage.java    From Spring with Apache License 2.0 4 votes vote down vote up
public IndexPage(WebDriver webDriver) {
	this.driver = webDriver;
	PageFactory.initElements(webDriver, this);
}
 
Example 19
Source File: IndexPage.java    From Spring with Apache License 2.0 4 votes vote down vote up
public IndexPage(WebDriver webDriver) {
	this.driver = webDriver;
	PageFactory.initElements(webDriver, this);
}
 
Example 20
Source File: BasePage.java    From aws-device-farm-appium-cucumber-tests-for-sample-app with Apache License 2.0 2 votes vote down vote up
/**
 * A base constructor that sets the page's driver
 *
 * The page structure is being used within this test in order to separate the
 * page actions from the tests.
 *
 * Please use the AppiumFieldDecorator class within the page factory. This way annotations
 * like @AndroidFindBy within the page objects.
 *
 * @param driver the appium driver created in the beforesuite method.
 */
protected BasePage(AppiumDriver driver){
    this.driver = driver;
    PageFactory.initElements(new AppiumFieldDecorator(driver, 5, TimeUnit.SECONDS), this);
}