pageobjects

Accessing a nested element 3 levels deep using page objects

Deadly 提交于 2020-01-05 10:32:35
问题 Using the Page Object model and gem I want to access an element that is nested 3 layers deep. I've successfully accessed nested elements that are 2 elements deep but for 3 the same method isn't working. 3 elements defined in my Page Object: div(:serv_info, :class => "service-info") div(:validate_method, :class => "validate-method") div(:scar_input_group, :class => "input-group") So I tried to chain those 3 elements to access the div class input-container input-left-half round like this: div(

LINQ performance issue while trying to find element collection by tag name and then find a specfic one by id or text using selenium webdriver

拥有回忆 提交于 2020-01-05 08:49:11
问题 I am not an expert in LINQ. Here is what I am trying to do. A. I am finding the collection of the elements of a page using the selenium webdriver API private ReadOnlyCollection<IWebElement> ReturnPageElements() { return Driver.FindElements(PageElementSelector); } where PageElementSelector is all the html tags(since it's long list, I did not paste it here). I then instantiate this method inside my BaseClass Constructor. B. I am using the following to find THE target element public IWebElement

Selenium/PageFactory: Find child elements using parent element's @FindBy?

我们两清 提交于 2020-01-02 11:06:12
问题 I'm trying to convert my selenium tests to use the Page Object Model (and, by extension, @FindBy). I have several object definitions like this: public WebElement objectParent() { return driver.findElement(By.name("parent-id")) ; } public WebElement objectChild() { WebElement elem = objectParent(); return elem.findElement(By.name("child-id")) ; } Converting the parent object to using @FindBy is easy: @FindBy(name = "parent-id") WebElement parentObj; Basically, I want to do something like this,

How to use WebDriver / Selenium 2 LoadComponents in PageObjects pattern?

北慕城南 提交于 2020-01-01 06:00:14
问题 I have a hard time to get used to the WebDriver PageObject pattern. Please share your experience and ways of using PageObjects pattern and loadableComponents. As PageObject represents usually a component or piece of functionality, it occurred to me at first that I should use it to actually do some things in load() and see if it does what it should in isLoaded(). Then I realized that it should be utilized only for "loading" objects (possibly initialization) as it is in case of moving around a

Selenium WebDriver [Java] How do I store the elements of an iframe in a PageFactory

江枫思渺然 提交于 2019-12-25 18:16:43
问题 I am following Page Object Model to automate a flow in one application. In one of the module I have to add a new post which have a "Title" and a "Body" field. As of now, I am able to send the text in the "Title" field as it is in the Top Window. But the "Body" is within an iframe. After passing the text in "Title" I tried to switch to the iframe before writing in the "Body". This piece of code I have written in the main file. But Selenium shows an error as org.openqa.selenium

Selenium WebDriver [Java] How do I store the elements of an iframe in a PageFactory

给你一囗甜甜゛ 提交于 2019-12-25 18:16:29
问题 I am following Page Object Model to automate a flow in one application. In one of the module I have to add a new post which have a "Title" and a "Body" field. As of now, I am able to send the text in the "Title" field as it is in the Top Window. But the "Body" is within an iframe. After passing the text in "Title" I tried to switch to the iframe before writing in the "Body". This piece of code I have written in the main file. But Selenium shows an error as org.openqa.selenium

Is it possible to use siteprism variables to define new variables when defining the page object?

余生长醉 提交于 2019-12-25 06:53:44
问题 I'm working on a cucumber, ruby, capybara, siteprism project and we're defining most UK variables in a siteprism page object. Is there a way for me to use the siteprism variables that I create as part of the definition for new variables? For example, if I've got a siteprim page that looks like: sections :user_container, "#user_container" do sections :address_module, "#address" do element :house_number, "#house_number" end end Can I somehow define new variables on the same pageobject

Page Object Model structure for a complex application

允我心安 提交于 2019-12-25 01:48:25
问题 I've in the past couple of months used Puppeteer to drive an automation for a couple of small level projects. Now I want to scale the framework for a medium/large complex application. I want to use the famed Page Object Model, where in I have separated the locators, page methods in separate files and I'm calling them in the corresponding page execution code. My directory structure is like this e2e_tests - locators - common-locators.js - page1locators.js - page2locators.js - constants - config

Disabling browser javascript with Selenium webdriver + specflow + c# + Pageobject + pagefactory

让人想犯罪 __ 提交于 2019-12-24 11:01:35
问题 I want to disable firefox javascript and run my automated test. I am using Specflow + c# and selenium. I am also using PageObject pattern and Page factory. My feature file goes this way : Scenario: Search for item after disabling the javascript Given I am a ACUST When I disable the javascript And I have entered a text 'dress' string to search for that matches a product Then The relevant search results for the 'dress' will be returned My code is as follows : using System; using System

StaleElementReference Exception in PageFactory

瘦欲@ 提交于 2019-12-24 10:32:01
问题 I am trying to learn the PageFactory model. I understood the fact that when we do a initElements , the WebElements are located. Say for example, I click on a webelement and because of which there is a change in one of the other webelements in DOM. Now, obviously I would get a StaleElementReferenceException here. How would I resolve this issue? Should I find that specific WebElement again knowing the fact that there can be a change in the WebElement's properties in the DOM? or is there an