Questions tagged [pageobjects]

A design pattern to represent a web page as an object. Usually used in UI / end-to-end testing and browser automation.

A page object provides access to a web page. In its implementation, a page object typically makes use of a web driver like or . The page object hides the html and web driver details, and provides an abstract interface to the page in terms of its application domain.

The page objects are subsequently used to create end-to-end test scenarios that click through the application. The use of page objects make these tests easier to maintain when details of the underlying pages change.

This tag can be used for questions on the design, implementation, and use of page objects for end-to-end testing of web applications.

More information:

845 questions
3
votes
2 answers

Protractor page object issues

I seem to be stuck in the construction of page objects. I read a lot of docs about page objects and know that they contain two things: elements that are present on a page functions to interact with the page When I check example files I see that…
Homewrecker
  • 1,076
  • 1
  • 15
  • 38
3
votes
1 answer

Testing multiple browsers with protractor backed by page objects

I'm writing a test where two browsers need to interact. The problem with simply forking the browser is that my page objects still reference the old browser. I didn't want to rewrite all of my PO's to take the browser as a parameter so I tried the…
Fitzpleasure
  • 109
  • 1
  • 13
3
votes
1 answer

Access inner element from within an element in protractor

I came across concept of Page Objects, and used it in writing tests in Protractor, but I am facing an issue. The old code was as follows. var productList = element.all(by.repeater('product in…
Saba
  • 3,418
  • 2
  • 21
  • 34
3
votes
1 answer

Class structure using Java Selenium SlowLoadableComponent

I'm designing an application using Selenium and their PageFactory. Each of my page object classes inherits from a base class with the standard methods in, but I also have a few pages which require SlowLoadableComponent. As this is implemented as an…
Ian
  • 1,507
  • 3
  • 21
  • 36
3
votes
1 answer

Trying to access nested function, "undefined is not a function"

I'm working on some end-to-end tests using JavaScript (Protractor). I've got a PageObjects file that contains the following: var SomeClass = function() { this.get = function() { browser.get('http://blah'); }; this.person =…
Towercap
  • 175
  • 1
  • 8
3
votes
3 answers

Page Factory @FindBy

I am currently learning page object model (POM) and I am trying to access a specific web element using @FindBy but I am not sure how to correctly write the syntax for my element into @FindBy? What I have…
Robben
  • 457
  • 2
  • 8
  • 20
3
votes
1 answer

NightWatch.js - get a list of child WebElements based on relative css locator

Hello all NightWatch adopters, I am trying to parse a table with the following format to get a a list of rows and the cell in each rows // 1 row Item A // name John // owner Monday // create…
mekdev
  • 468
  • 6
  • 14
3
votes
2 answers

NPE when constructor is being called

I have the following java class (implements page object pattern) package core.pageObjects; import org.openqa.selenium.*; public class ConsultaClientePorDocumento { private WebDriver driver; public ConsultaClientePorDocumento(WebDriver…
user3245906
  • 175
  • 9
3
votes
0 answers

Returning another Page Object from a Page Object function in webdriverJS / Protractor?

I am used to WebDriver Java approach for implementing Page Object pattern, which is described here So everything in Java WebDriver Page Object pattern boils down to following: The public methods represent the services that the page offers Try…
3
votes
4 answers

How to perform drag and drop using page-object?

I need to perform drag and drop action for a scenario, How can I able to achieve this using Page-Object. I need to click an element (like button from options) and drop it in a text area. I have search for a solution but I can't able to find. Please…
KAK
  • 905
  • 4
  • 14
  • 33
3
votes
1 answer

WebDriver Explicit wait in Page Object model

We currently have a big selenium junit project which uses the page object model. We make use of the @FindBy annotation to declare our WebElements. Now when we run the tests, we randomly get the NoSuchelementException, which means the page might not…
3
votes
1 answer

Holding IWebElements as a collection in C#/Selenium when using [FindsBy] attribute

I'm trying to set multiple IWebElements to a collection using [FindsBy] attribute included in OpenQA.Selenium.Support.PageObjects, like following. Suppose I want to hold all "li" elements in instance variable "MyElements". HTML
Ryo
  • 2,003
  • 4
  • 27
  • 42
3
votes
1 answer

Which WebElements are filled by PageFactory.initElements?

I am trying to use the PageObject design pattern with my Selenium testing, and I have the following set of Page classes: A PageObject base class, which keeps track of the WebDriver and site's base URL. It also has private WebElement resources…
3
votes
3 answers

How to get the html source of a page_object element?

Imagine i have a div like (in Watir language): @browser.div(:id, 'home_slideshow') I need the html code inside to do some "magic regex" :). The way to get the div html code could be: the_div_html = @browser.div(:id, 'home_slideshow').html Ok. I'm…
3
votes
5 answers

Webdriver SwitchTo()

I am beginner in webdriver started learning page object model Here is the code i use: public static class test1 { public static ISearchContext Driver { get { return webDriver; } } } public static…
Anand S
  • 760
  • 5
  • 13
  • 28