Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
how to use AjaxElementLocatorFactory with page objects and PageFactory
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Expand all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
urbanblock  
View profile  
 More options Jun 11 2010, 4:27 am
From: urbanblock <dylan.hazlehu...@gmail.com>
Date: Fri, 11 Jun 2010 01:27:10 -0700 (PDT)
Local: Fri, Jun 11 2010 4:27 am
Subject: how to use AjaxElementLocatorFactory with page objects and PageFactory
Hi
Is anyone able to provide an example of a Test and PageObject using
the AjaxElementLocatorFactory with the PageFactory. I have checked out
the various posts on AjaxElementLocatorFactory, but I haven't been
able to get it working, as the examples have been too brief for me.

Regards,
Dylan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
sqa tester  
View profile  
 More options Jun 14 2010, 1:49 pm
From: sqa tester <thesqates...@gmail.com>
Date: Mon, 14 Jun 2010 10:49:20 -0700 (PDT)
Local: Mon, Jun 14 2010 1:49 pm
Subject: Re: how to use AjaxElementLocatorFactory with page objects and PageFactory
In my case, I only use the AjaxElementLocatorFactory in the
constructor of my page objects.

Please see example below. Hopefully it will give you some idea of the
usage.

/***
* This is the parent class where shared services are available.
***/
public abstract class AbstractParentPage {

public int DRIVER_WAIT = 30; // 30 seconds
        /***
         * Constructor
         * @param driver an instance of WebDriver
         */
        public AbstractAIPage(WebDriver driver){
        ElementLocatorFactory finder =  new
AjaxElementLocatorFactory(driver,
DRIVER_WAIT);
        PageFactory.initElements(finder, this);
        this.driver = driver;

}

------ Add services accessible to all pages here ----

}

/***
* This is the login page
***/
public class LoginPage extends AbstractParentPage{
        @FindBy(id = "username")
        private WebElement usernameTextBox;
        @FindBy(id = "password")
        private WebElement passwordTextBox;
        /***
         * constructor
         * @param driver an instance of WebDriver
         */
        public LoginPage(WebDriver driver) {
                super(driver);
                ElementLocatorFactory finder =  new
AjaxElementLocatorFactory(driver, DRIVER_WAIT);
            PageFactory.initElements(finder, this);
            this.driver = driver;
        }

        public HomePage login(String username, String password){
             usernameTextBox.clear();
             usernameTextBox.sendKeys(username);
             passwordTextBox.clear();
             passwordTextBox.sendKeys(password);
             passwordTextBox.submit();
             return new HomePage(driver);

        }

}

------------------------------------------------------------------

Test Code:

WebDriver driver = new FirefoxDriver();
LoginPage loginPage = new LoginPage(driver);
HomePage homePage = loginPage.login("username","password");

In test code, only services in page objects are accessed. With the use
of AjaxElementLocatorFactory in page object constructor, webdriver
waits for a web element the specified time in DRIVER_WAIT (30 seconds
in the example above) before timing out and throwing No Such Element
Found exception.

On Jun 11, 1:27 am, urbanblock <dylan.hazlehu...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
urbanblock  
View profile  
 More options Jun 17 2010, 2:21 am
From: urbanblock <dylan.hazlehu...@gmail.com>
Date: Wed, 16 Jun 2010 23:21:52 -0700 (PDT)
Local: Thurs, Jun 17 2010 2:21 am
Subject: Re: how to use AjaxElementLocatorFactory with page objects and PageFactory
Hi
Thanks, that is great. It has made it very clear for me.

Regards,
Dylan

On Jun 15, 5:49 am, sqa tester <thesqates...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »