pageobjects

Does the Selenium FindBy instantiate WebElement instances in a PageObject class?

一笑奈何 提交于 2019-12-24 00:02:45
问题 Does the Selenium FindBy annotation actually instantiate WebElement instances, and if so, what is the connotation to the framework that uses them? What I have been doing in my page objects looks like this right now. All my test framework methods take By locators as arguments (not WebElement instances). //fields in the page public static final By SEARCH_BOX = By.id("input-what"); My question is, does using FindBy instantiate WebElement instances at the time of class instantiation? If so, then

Protractor Page objects - TypeError: Object #<Object> has no method 'methodName'

微笑、不失礼 提交于 2019-12-23 01:54:37
问题 I'm trying to write a simple test using page objects pattern - based on the 'docs/page-objects'. I created a file describing the page object and other using this page object to test a page. //page object var LoginPage = function() { this.userInput = browser.driver.findElement(by.id('username')); this.pwdInput = browser.driver.findElement(by.id('password')); this.btnEnter = browser.driver.findElement(by.id('btnLogin')); this.get = function(){ browser.get('http://example.com'); }; this.setUser

Using Data Objects while E2E testing with Protractor

风格不统一 提交于 2019-12-22 14:16:35
问题 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

How to prevent StaleElementReferenceException in PageFactory in Selenium C#?

独自空忆成欢 提交于 2019-12-22 13:52:20
问题 I have a Selenium WebDriver Page Object Model in C# 6. I am experiencing StaleElementReferenceException s while trying to click on ajax-loaded nav bar elements. This is confusing, because I'm using PageFactory , without any [CacheLookup] s. Here's the code in question. I've tried to simplify to just the important parts. (I actually pass around a Driver , a wrapper around IWebDriver .) MenuBar.SelectEnglish<T>() throws the exception. public class Tests { [Test] public void SelectEnglishTest()

Running multiple browser instances in the same test spec

﹥>﹥吖頭↗ 提交于 2019-12-22 11:34:12
问题 If I have a single spec that is using page object model, how do I run multiple browser instance for that same spec? For example I have spec: it('should run multi browser', function() { browser.get('http://example.com/searchPage'); var b2 = browser.forkNewDriverInstance(); b2.get('http://example.com/searchPage'); var b3 = browser.forkNewDriverInstance(); b3.get('http://example.com/searchPage'); SearchPage.searchButton.click(); b2.SearchPage.searchButton.click(); //fails here b3.SearchPage

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

寵の児 提交于 2019-12-21 19:16:44
问题 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

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

给你一囗甜甜゛ 提交于 2019-12-21 19:16:13
问题 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

Implementing PageObjects pattern for frames in a page

倖福魔咒の 提交于 2019-12-21 06:50:59
问题 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

How to build a method to iterate through WebElements and return the one that is displayed using Selenium & Java?

若如初见. 提交于 2019-12-20 07:23:28
问题 So, the page is filled with a lot of similar properties like these two elements below. Examples: <button id="exibe_codigo_de_barras_210888-1" data-context="minhas-contas_conta_codigo-barras_btn-ver-codigo-barras-colapse" font-size="0.875rem" width="100%" class="styled__Button-sc-6mz6kj-0 gMrMBo" style="" xpath="1">VER CÓDIGO DE BARRAS <span class="sc-1o2smz3-2 dAGdGd styled__Arrow-tuh5ii-0 iYDeiw"><svg width="12px" height="8px" viewBox="0 0 12 8" version="1.1" xmlns="http://www.w3.org/2000

Codeception, write acceptance tests with the pageObject design pattern and gherkin

浪尽此生 提交于 2019-12-18 18:34:33
问题 I'm looking for a simple example of code with the pageObject design pattern and gherkin because when I follow the codeception BDD documentation, all examples written in the tests/ support/AcceptanceTester.php. I don't understand (poor english skills - -) how not concentrate all code in the AcceptanceTester.php file. By example, I have a sample home page with two buttons A and B. If the user click on the button A, the page A is loaded else if the user click on button B, the page B is loaded.