bichromate.sample.pageDeclaration.BichromateTableTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Bichromate Show documentation
Show all versions of Bichromate Show documentation
Java, Selenium, Appium, Winium, Extend, and TestNG automated testing framework. Bichromate integrates the best of these frameworks and takes automation to the next level. With Bichromate there is one function call that builds any type of Web,IOS Mobile, Android, and Windows App driver on any platform (Windows, Mac, Linux). From Local web drivers, to SauceLabs, Browserstack, and Selenium grid. Build data driven tests is never easier.
Bichromate also gives you built in Factories that, access DBs, Video Capture, FTP, POM Generation, Hilite element.
/*
* BichromateTableTest.java, Version 1.0, Created 2018-08-03-17-43-17
*
* Copyright (c) 2001~2016 by David Ramer, Inc. All Rights Reserved.
*
* David Ramer grants you ("Licensee") a non-exclusive, royalty free, license to use,
* modify and redistribute this software in source and binary code form,
* provided that i) this copyright notice and license appear on all copies of
* the software; and ii) Licensee does not utilize the software in a manner
* which is disparaging to David Ramer.
*
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
* IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. David Ramer AND ITS LICENSORS SHALL NOT BE
* LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
* OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL David Ramer OR ITS
* LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
* INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
* CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
* OR INABILITY TO USE SOFTWARE, EVEN IF DRamer HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* This software is not designed or intended for use in on-line control of
* aircraft, air traffic, aircraft navigation or aircraft communications; or in
* the design, construction, operation or maintenance of any nuclear
* facility. Licensee represents and warrants that it will not use or
* redistribute the Software for such purposes.
*
*
* POWERED BY: Bichromate
*
*/
//TODO enable the package
package bichromate.sample.pageDeclaration;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
//import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;
//import org.testng.Assert;
//import org.testng.Reporter;
//
// Base Page Declaration
//
import bichromate.core.sTestBasePageDeclaration;
import bichromate.baseObjectTypes.sTestButtonObject;
import bichromate.baseObjectTypes.sTestCheckBoxObject;
//import bichromate.tools.sTestPOMFactory;
//
// Element Objects
//
import bichromate.baseObjectTypes.sTestDropDownList;
import bichromate.baseObjectTypes.sTestLinkObject;
import bichromate.baseObjectTypes.sTestModalDialog;
import bichromate.baseObjectTypes.sTestRangeObject;
import bichromate.baseObjectTypes.sTestTabLinkObject;
import bichromate.baseObjectTypes.sTestTableObject;
import bichromate.baseObjectTypes.sTestTextBoxObject;
public class BichromateTableTest extends sTestBasePageDeclaration {
public String pageTitle = null;
public String pageURL = null;
private String link1 = "link1";
private String table1 = "table1";
private String table2 = "table2";
private String table3 = "table3";
private String dropdown1 = "dropdown1";
private String dropdown2 = "dropdown2";
private String textinput1 = "textinput1";
private String textinput2 = "textinput2";
private String range1 = "range1";
private String range2 = "range2";
private String tabLink1 = "tabLink1";
private String tabLink2 = "tabLink2";
private String tabLink3 = "tabLink3";
private String tabLink4 = "tabLink4";
private String link2 = "link2";
private String link3 = "link3";
private String link4 = "link4";
private String link5 = "link5";
private String link6 = "link6";
private String checkBox1 = "checkbox1";
private String checkBox2 = "checkbox2";
private String checkBox3 = "checkbox3";
private String openModalButton = "openModalButton";
private String modalDialog = "modalDialog";
private String alertButton = "alertButton";
//
// Objects
private sTestLinkObject link1Object = null;
private sTestTableObject table1Object = null;
private sTestTableObject table2Object = null;
private sTestTableObject table3Object = null;
private sTestDropDownList dropdown1Object = null;
private sTestDropDownList dropdown2Object = null;
private sTestTextBoxObject textinput1Object = null;
private sTestTextBoxObject textinput2Object = null;
private sTestRangeObject range1Object = null;
private sTestRangeObject range2Object = null;
private sTestTabLinkObject tabLink1Object = null;
private sTestTabLinkObject tabLink2Object = null;
private sTestTabLinkObject tabLink3Object = null;
private sTestTabLinkObject tabLink4Object = null;
private sTestLinkObject link2Object = null;
private sTestLinkObject link3Object = null;
private sTestLinkObject link4Object = null;
private sTestLinkObject link5Object = null;
private sTestLinkObject link6Object = null;
private sTestCheckBoxObject checkBox1Object = null;
private sTestCheckBoxObject checkBox2Object = null;
private sTestCheckBoxObject checkBox3Object = null;
private sTestButtonObject modalButton = null;
private sTestModalDialog modalDialogObject = null;
private sTestButtonObject alertButtonObject = null;
static ResourceBundle resources;
static {
try {
resources = ResourceBundle.getBundle("pageDeclarations.BichromateTableTest", Locale.getDefault());
} catch (MissingResourceException mre) {
System.out.println("BichromateTableTest.properties not found: " + mre);
System.exit(0);
}
}
public BichromateTableTest(WebDriver driver) {
super(driver, resources);
pageTitle = new String(resources.getString("pageTitle"));
pageURL = new String(resources.getString("pageURL"));
POMLOGGER.enterInfoLog("BichromateTableTest created");
}
/**
* getAlertButton().
* @return sTestButtonObject - button object
* @author BichroMATE
* @version 3.0
*/
public sTestButtonObject getAlertButton(){
if(null == alertButtonObject){
alertButtonObject = new sTestButtonObject(driver,findElement(alertButton),"sTestButtonObject",POMLOGGER);
}
return alertButtonObject;
}//getAlertButton
/**
* getModalDialog().
* @return sTestModalDialog - modalDialog
* @author BichroMATE
* @version 3.0
*/
public sTestModalDialog getModalDialog(){
if(null == modalDialogObject){
modalDialogObject = new sTestModalDialog(driver,findElement(modalDialog),"sTestModalDialog",POMLOGGER);
}
return modalDialogObject;
}//modalDialog
/**
* This function demonstrates getCheckBoxObject2().
* The sTestLinkObject
* @return sTestTabLinkObject - tab Object
* @author BichroMATE
* @version 3.0
*/
public sTestButtonObject getOpenModalButton(){
if(null == modalButton){
modalButton = new sTestButtonObject(driver,findElement(openModalButton),"sTestButtonObject",POMLOGGER);
}
return modalButton;
}//getOpenModalButton
/**
* This function demonstrates getCheckBoxObject2().
* The sTestLinkObject
* @return sTestTabLinkObject - tab Object
* @author BichroMATE
* @version 3.0
*/
public sTestCheckBoxObject getCheckBoxObject2(){
if(null == checkBox2Object){
checkBox2Object = new sTestCheckBoxObject(driver,findElement(checkBox2),"sTestCheckBoxObject",POMLOGGER);
}
return checkBox2Object;
}//getCheckBoxObject2
/**
* This function demonstrates getTabLinkObject1().
* The sTestLinkObject
* @return sTestTabLinkObject - tab Object
* @author BichroMATE
* @version 3.0
*/
public sTestCheckBoxObject getCheckBoxObject1(){
if(null == checkBox1Object){
checkBox1Object = new sTestCheckBoxObject(driver,findElement(checkBox1),"sTestCheckBoxObject",POMLOGGER);
}
return checkBox1Object;
}//getCheckBoxObject1
/**
* getTabLinkObject1().
*
* @return sTestTabLinkObject - tab Object
* @author BichroMATE
* @version 3.0
*/
public sTestCheckBoxObject getCheckBoxObject3(){
if(null == checkBox3Object){
checkBox3Object = new sTestCheckBoxObject(driver,findElement(checkBox3),"sTestCheckBoxObject",POMLOGGER);
}
return checkBox3Object;
}//getCheckBoxObject1
/**
* This function demonstrates getTabLinkObject1().
* The sTestLinkObject
* @return sTestTabLinkObject - tab Object
* @author BichroMATE
* @version 3.0
*/
public sTestTabLinkObject getTabLinkObject2(){
if(null == tabLink2Object){
tabLink2Object = new sTestTabLinkObject(driver,findElement(tabLink2),"sTestTabLinkObject",POMLOGGER);
}
return tabLink2Object;
}//getTabLinkObject2
/**
* This function demonstrates getTabLinkObject3().
* The sTestLinkObject
* @return sTestTabLinkObject - tab Object
* @author BichroMATE
* @version 3.0
*/
public sTestTabLinkObject getTabLinkObject3(){
if(null == tabLink3Object){
tabLink3Object = new sTestTabLinkObject(driver,findElement(tabLink3),"sTestTabLinkObject",POMLOGGER);
}
return tabLink3Object;
}//getTabLinkObject3
/**
* This function demonstrates getTabLinkObject4().
* The sTestLinkObject
* @return sTestTabLinkObject - tab Object
* @author BichroMATE
* @version 3.0
*/
public sTestTabLinkObject getTabLinkObject4(){
if(null == tabLink4Object){
tabLink4Object = new sTestTabLinkObject(driver,findElement(tabLink4),"sTestTabLinkObject",POMLOGGER);
}
return tabLink4Object;
}//getTabLink4Object
/**
* This function demonstrates getTabLinkObject1().
* The sTestLinkObject
* @return sTestTabLinkObject - tab Object
* @author BichroMATE
* @version 3.0
*/
public sTestTabLinkObject getTabLinkObject1(){
if(null == tabLink1Object){
tabLink1Object = new sTestTabLinkObject(driver,findElement(tabLink1),"sTestTabLinkObject",POMLOGGER);
}
return tabLink1Object;
}//getTabLinkObject1
/**
* This function demonstrates getLink1().
* The sTestLinkObject
* @return sTestTextBoxObject - text box object
* @author BichroMATE
* @version 3.0
*/
public sTestLinkObject getLink1(){
if(null == link1Object){
link1Object = new sTestLinkObject(driver,findElement(link1),"sTestLinkObject",POMLOGGER);
return link1Object;
}
return link1Object;
}
/**
* This function demonstrates getTable1().
* The sTestTableObject
* @return sTestTextBoxObject - text box object
* @author BichroMATE
* @version 3.0
*/
public sTestTableObject getTable1(){
if(null == table1Object){
table1Object = new sTestTableObject(driver,findElement(table1),"sTestTableObject",POMLOGGER);
return table1Object;
}
return table1Object;
}
/**
* This function demonstrates getTable2().
* The sTestTableObject
* @return sTestTextBoxObject - text box object
* @author BichroMATE
* @version 3.0
*/
public sTestTableObject getTable2(){
if(null == table2Object){
table2Object = new sTestTableObject(driver,findElement(table2),"sTestTableObject",POMLOGGER);
return table2Object;
}
return table2Object;
}
/**
* This function demonstrates getTable3().
* The sTestTableObject
* @return sTestTextBoxObject - text box object
* @author BichroMATE
* @version 3.0
*/
public sTestTableObject getTable3(){
if(null == table3Object){
table3Object = new sTestTableObject(driver,findElement(table3),"sTestTableObject",POMLOGGER);
return table3Object;
}
return table3Object;
}
/**
* This function demonstrates getDropdown1().
* The sTestDropDownList
* @return sTestTextBoxObject - text box object
* @author BichroMATE
* @version 3.0
*/
public sTestDropDownList getDropdown1(){
if(null == dropdown1Object){
dropdown1Object = new sTestDropDownList(driver,findElement(dropdown1),"sTestDropDownList",POMLOGGER);
return dropdown1Object;
}
return dropdown1Object;
}
/**
* This function demonstrates getDropdown2().
* The sTestDropDownList
* @return sTestTextBoxObject - text box object
* @author BichroMATE
* @version 3.0
*/
public sTestDropDownList getDropdown2(){
if(null == dropdown2Object){
dropdown2Object = new sTestDropDownList(driver,findElement(dropdown2),"sTestDropDownList",POMLOGGER);
return dropdown2Object;
}
return dropdown2Object;
}
/**
* This function demonstrates getTextinput1().
* The sTestTextBoxObject
* @return sTestTextBoxObject - text box object
* @author BichroMATE
* @version 3.0
*/
public sTestTextBoxObject getTextinput1(){
if(null == textinput1Object){
textinput1Object = new sTestTextBoxObject(driver,findElement(textinput1),"sTestTextBoxObject",POMLOGGER);
return textinput1Object;
}
return textinput1Object;
}
/**
* This function demonstrates getTextinput2().
* The sTestTextBoxObject
* @return sTestTextBoxObject - text box object
* @author BichroMATE
* @version 3.0
*/
public sTestTextBoxObject getTextinput2(){
if(null == textinput2Object){
textinput2Object = new sTestTextBoxObject(driver,findElement(textinput2),"sTestTextBoxObject",POMLOGGER);
return textinput2Object;
}
return textinput2Object;
}
/**
* This function demonstrates getRange1().
* The sTestRangeObject
* @return sTestTextBoxObject - text box object
* @author BichroMATE
* @version 3.0
*/
public sTestRangeObject getRange1(){
if(null == range1Object){
range1Object = new sTestRangeObject(driver,findElement(range1),"sTestRangeObject",POMLOGGER);
return range1Object;
}
return range1Object;
}
/**
* This function demonstrates getRange2().
* The sTestRangeObject
* @return sTestTextBoxObject - text box object
* @author BichroMATE
* @version 3.0
*/
public sTestRangeObject getRange2(){
if(null == range2Object){
range2Object = new sTestRangeObject(driver,findElement(range2),"sTestRangeObject",POMLOGGER);
return range2Object;
}
return range2Object;
}
/**
* This function demonstrates getLink2().
* The sTestLinkObject
* @return sTestTextBoxObject - text box object
* @author BichroMATE
* @version 3.0
*/
public sTestLinkObject getLink2(){
if(null == link2Object){
link2Object = new sTestLinkObject(driver,findElement(link2),"sTestLinkObject",POMLOGGER);
return link2Object;
}
return link2Object;
}
/**
* This function demonstrates getLink3().
* The sTestLinkObject
* @return sTestTextBoxObject - text box object
* @author BichroMATE
* @version 3.0
*/
public sTestLinkObject getLink3(){
if(null == link3Object){
link3Object = new sTestLinkObject(driver,findElement(link3),"sTestLinkObject",POMLOGGER);
return link3Object;
}
return link3Object;
}
/**
* This function demonstrates getLink4().
* The sTestLinkObject
* @return sTestTextBoxObject - text box object
* @author BichroMATE
* @version 3.0
*/
public sTestLinkObject getLink4(){
if(null == link4Object){
link4Object = new sTestLinkObject(driver,findElement(link4),"sTestLinkObject",POMLOGGER);
return link4Object;
}
return link4Object;
}
/**
* This function demonstrates getLink5().
* The sTestLinkObject
* @return sTestTextBoxObject - text box object
* @author BichroMATE
* @version 3.0
*/
public sTestLinkObject getLink5(){
if(null == link5Object){
link5Object = new sTestLinkObject(driver,findElement(link5),"sTestLinkObject",POMLOGGER);
return link5Object;
}
return link5Object;
}
/**
* This function demonstrates getLink6().
* The sTestLinkObject
* @return sTestTextBoxObject - text box object
* @author BichroMATE
* @version 3.0
*/
public sTestLinkObject getLink6(){
if(null == link6Object){
link6Object = new sTestLinkObject(driver,findElement(link6),"sTestLinkObject",POMLOGGER);
return link6Object;
}
return link6Object;
}
//
// Inner class for testing on the command line
//
public static class Test
{
public static void main(final String[] args){
BichromateTableTest btt = null;
RemoteWebDriver driver = null;
btt = new BichromateTableTest(driver);
if(btt != null){
System.out.println("pageURL = "+btt.pageURL);
System.out.println("pageTitle = "+btt.pageTitle);
}
} // end Main
} // end Inner class Test
/**
* This function demonstrates isAjaxLoaded().
* Every Page must override this function because each page might have a different way to determine if Ajax is loaded.
* @return boolean - ajax has loaded the table1
* @author DRamer
* @version 3.0
*/
@Override
public boolean isAjaxLoaded() {
//
// Here we look for the table to see if it has only one row
// that says no data loaded. This is custom for this table
//
WebDriverWait wait = new WebDriverWait(driver, 180);
ExpectedCondition jQueryLoad = new ExpectedCondition() {
@Override public Boolean apply(WebDriver driver) {
int rowCount = getTable1().countRows();
if(rowCount <=1){
return false;
}else{
return true;
}
}
};
return wait.until(jQueryLoad);
}//isAjaxLoaded
}// BichromateTableTest.java Created By Bichromate, 2018-08-03-17-43-17