pageobjects

WebDriver PageObjects & Large Amounts of Locators

丶灬走出姿态 提交于 2019-12-06 09:33:40
Over the past year I built a very nice WebDriver framework for my group. Pretty standard fare: Page classes typically encapsulate the full functionality of a page in on our platform (controls as By objects, methods as needed) & extend a base class with some global methods, multiple pages are invoked within JUnit test classes, typical assertion methods, yada yada. Nothing extravagant-very by the books but very functional and flexible. Recently, however, I have been asked to use the framework to automate a large number of pages with forms that can hold 100 or even more inputs, selects, options,

Using Data Objects while E2E testing with Protractor

你离开我真会死。 提交于 2019-12-06 05:24:05
So a coworker and I were discussing making a data object for our e2e tests. From my understanding about data objects they are used for decoupling your test suites. For example, my first test suite is to create an account and to test if the fields are valid and the second test suite logins into the account and does its own tests. I am told it is good to use data objects (not a page object) just incase the first test suite fails when making an account. That way we can use the data object in the second test suite to create a new user just for testing login. My problem is that if my first test

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

你。 提交于 2019-12-05 22:45:33
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 <tbody> <tr> // 1 row <td>Item A</td> // name <td>John</td> // owner <td>Monday</td> // create date </tr> <tr> // 2 row <td>Item B</td> <td>Mary</td> <td>Tuesday</td> </tr> </tbody> The code now looks like this which calls the function below. browser.elements('css selector', 'tbody tr', getResultsList); Where my function for parsing now looks like this. function getResultsList(rowResults){ // Here we get the correct set of rows console.log(rowResults.length +

Is JavaScript compatible with strict Page Object Pattern?

[亡魂溺海] 提交于 2019-12-05 06:30:47
I have built various Test Automation frameworks using the Page Object Pattern with Java ( https://code.google.com/p/selenium/wiki/PageObjects ). Two of the big benefits I have found are: 1) You can see what methods are available when you have an instance of a page (e.g. typing homepage. will show me all the actions/methods you can call from the homepage) 2) Because navigation methods (e.g. goToHomepage()) return an instance of the subsequent page (e.g. homepage), you can navigate through your tests simply by writing the code and seeing where it takes you. e.g. WelcomePage welcomePage =

when do FindBy attributes trigger a driver.FindElement?

限于喜欢 提交于 2019-12-04 23:41:57
问题 My question is: do webelements decorated with findby attributes call the findelement function upon each reference to them? If not, when? And what is the procedure with List< webelement > which is also decorated? Does it trigger when you reference the list, or when you reference an element inside that list? I'm asking because I have some situations where I'm getting stale element exceptions and I want to know how to deal with them. 回答1: WebElements are evaluated lazily. That is, if you never

Does Webdriver support pagefactory for Python?

情到浓时终转凉″ 提交于 2019-12-04 20:53:49
问题 I was reading about page objects and design patterns on the Webdriver project site and came across pagefactory. It doesn't look like the Webdriver for Python API includes pagefactory. Is this true? 回答1: I don't think there is any equivalents of the Java annotations (@Find(By.xxx) etc) in Python. But it doesn't mean that you can't use the PageObject pattern. You can find good example on how to do here : https://github.com/SeleniumHQ/selenium/blob/master/py/test/selenium/webdriver/common/google

PageObjects + non-angular page - how to join them?

孤人 提交于 2019-12-04 09:10:37
I'm writing some protractor tests for our application. There is one place where is non-angular page as iframe in angular page. Problem: I'm unable to map fields from non-angular page in Page Object object and use them in right time in my test specs. Notes: I tried write Page Object as object (var DamagePage: {}) and as function (var DamagePage = function() {}) too. Both works bad in this situation. Calling fields from non-angular page in spec works obviously fine, but I want to have it in Page Object for correct project organization. I have set browser.driver.ignoreSynchronization = true; Here

How to initialize SelectElements while using PageFactory / FindsBy in Selenium C#?

こ雲淡風輕ζ 提交于 2019-12-04 08:37:42
问题 I am building a Page Object Model in Selenium WebDriver for C#, using the PageFactory. Unfortunately, I have discovered that the FindsByAttribute will not initialize a SelectElement (HTML <select> tag / dropdown menu). I've happened upon or come up with a few ideas to work around it so far, but none of them is ideal: PageFactory and FindsByAttribute are sealed , so I can't force it to by just inheriting those. Manually instantiating a SelectElement from an IWebElement in each method is rather

Implementing PageObjects pattern for frames in a page

一笑奈何 提交于 2019-12-03 22:47:13
How to implement the pageObject pattern(Selenium) for frames in a page..I have a home page and there is a left frame and Right frame and i would like to create page object for each frame.. For example, I have the LeftFrame Page Object as below: Public Class HomePageLeftFrame{ private WebElement link; private WebElement textField; } How to write the @FindBy annotation for the two elements in the HomePageLeftFrame object...Is there a way? Note: As per the documentation on the selenium for pageObjects it is mentioned that page objects can be a whole HTML page or part of a page..Is my

when do FindBy attributes trigger a driver.FindElement?

孤街浪徒 提交于 2019-12-03 16:29:26
My question is: do webelements decorated with findby attributes call the findelement function upon each reference to them? If not, when? And what is the procedure with List< webelement > which is also decorated? Does it trigger when you reference the list, or when you reference an element inside that list? I'm asking because I have some situations where I'm getting stale element exceptions and I want to know how to deal with them. WebElements are evaluated lazily. That is, if you never use a WebElement field in a PageObject, there will never be a call to "findElement" for it. Reference . If