pageobjects

Wait for element - WebDriver - PageObject pattern

余生颓废 提交于 2019-11-28 06:35:06
As long as I use PageObject pattern I wondered where should I wait for element on dynamic pages. Assuming we have test method and pageObject class. Should I do something like (in test method): Click on button Wait for element to be displayed Verify the element (contains eg. method isElementDisplayed()) Or maybe there is other good practice to wait for the element? Maybe we should wait for element in method isElementDisplayed which is in PageObject.class? You should wait for elements in your page object class, not in test class, because your elements should be defined in page object class, test

Pythonic way to resolve circular import statements?

爷,独闯天下 提交于 2019-11-28 04:41:12
I just inherited some code which makes me uneasy: There is a testing library, full of classes corresponding to webpages on our site, and each webpage class has methods to automate the functionality on that page. There are methods to click the link between pages, which returns the class of the linked page. Here's a simplified example: File homePageLib.py: class HomePage(object): def clickCalendarLink(self): # Click page2 link which navigates browswer to page2 print "Click Calendar link" # Then returns the page2 object from calendarLib import CalendarPage return CalendarPage() File calendarLib

How to avoid Compound Class name error in Page Object?

与世无争的帅哥 提交于 2019-11-27 20:15:42
When I try to use the class name that having space class = "country name" in page object, I'm getting: Compound class names not permitted Selenium::WebDriver::Error::UnknownError) How can I use the class name that having space. Eg: class = "country name" Use a CSS selector instead: .country.name The important thing to note is that this example is wrong! If "country name" is meant as a name of a country, that is. Class names can't have spaces in them. In fact, the class attribute is a space-separated list of classes. That means that if you have a class country name , it's not one class, it's

Using PageObjects, Page Factory and WebDriverWait in Selenium WebDriver using Java

不想你离开。 提交于 2019-11-27 18:46:42
问题 I've been using Selenium WebDriver to implement functional tests for some projects that I've worked with. I'm trying to use the Page Object design pattern with Page Factory to factor out my locators. I've also created a static WaitTool object (singleton) that implements several waiting techniques with optional timeout parameters. My current problem is that I would like to use my wait methods before the PageFactory attempts to initialise the WebElements. The reason I would like to wait is

What is the Page Object Pattern in Selenium WebDriver? [closed]

谁都会走 提交于 2019-11-27 17:18:27
What is page object pattern in Selenium WebDriver? What is the use of it and how can we use this in Selenium WebDriver? Example will be appreciated. The documentation has already covered this. If you have any specific questions, feel free to edit your main post. Official: Page Objects and PageFactory on Selenuim Wiki. Page Object Design Pattern on Selenium official site. Unofficial: Do a Google search, you will get a lot info on this. Page Object Pattern Page Objects in Selenium 2.0 Selenium 2/WebDriver Quick Tips: Page Object Navigation Strategies PageObject by Martin Fowler [Edited to

How to implement WebDriver PageObject methods that can return different PageObjects

 ̄綄美尐妖づ 提交于 2019-11-27 09:53:39
问题 I've just started using WebDriver, and I'm trying to learn the best practices, in particular using PageObjects and PageFactory. It's my understanding that PageObjects should expose the various operations on a web page, and isolate the WebDriver code from the test class. Quite often, the same operation can result in navigating to different pages depending on the data used. For example, in this hypothetical Login scenario, providing admin credentials takes you to the AdminWelcome page, and

How to add explicit wait in PageFactory in PageObjectModel?

被刻印的时光 ゝ 提交于 2019-11-27 09:50:44
I have added hardcode wait thread.sleep() in my below code. How to use explicit wait. I want to wait till "username" WebElement appear. My program is working perfectly. I have already written testcases. package com.pol.zoho.PageObjects; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.WebDriverWait; public class ZohoLoginPage { WebDriver driver; public ZohoLoginPage(WebDriver driver) { PageFactory.initElements(driver, this); } @FindBy

NullpointerException while invoking SendKeys through Selenium using PageFactory with Page Object

大憨熊 提交于 2019-11-27 08:41:27
问题 I have three classes. One for getting all elements from the Webpage, one for performing actions with those elements and one for the test scripts. I get a null pointer exception when I call a function from the test script. I figured out this is because I use @FindBy annotation, but I don't know how to fix this. Elements Class: public class LoginPageElements { @FindBy(id="loginId") private static WebElement userNameTextBox; @FindBy(id="password") private static WebElement userPasswordTextBox;

Wait for element - WebDriver - PageObject pattern

落爺英雄遲暮 提交于 2019-11-27 01:30:06
问题 As long as I use PageObject pattern I wondered where should I wait for element on dynamic pages. Assuming we have test method and pageObject class. Should I do something like (in test method): Click on button Wait for element to be displayed Verify the element (contains eg. method isElementDisplayed()) Or maybe there is other good practice to wait for the element? Maybe we should wait for element in method isElementDisplayed which is in PageObject.class? 回答1: You should wait for elements in

What is the Page Object Pattern in Selenium WebDriver? [closed]

非 Y 不嫁゛ 提交于 2019-11-26 18:57:04
问题 What is page object pattern in Selenium WebDriver? What is the use of it and how can we use this in Selenium WebDriver? Example will be appreciated. 回答1: The documentation has already covered this. If you have any specific questions, feel free to edit your main post. Official: Page Objects and PageFactory on Selenuim Wiki. Page Object Design Pattern on Selenium official site. Unofficial: Do a Google search, you will get a lot info on this. Page Object Pattern Page Objects in Selenium 2.0