ISFW: FAQ

What are the features provided by ISFW?

  • Extended Selenium
    • Listeners
    • Custom commands
    • Reporting
  • Extended WebDriver
    • Provides extended webelemets
    • Listeners
    • Reporting
  • Extended WebElement
    • Self descriptive locator
    • Inbuilt wait, verify and assert methods
    • Listener support
    • Can be extended for Application specific custom component/elements
    • Lazy loaded webelements
    • Auto wait for Ajax — Dynamic elements
  • Choice of API for Development (Selenium RC and WD )
  • Descriptive report
  • Easy configurable test run
  • Enabling testing across multiple platforms with or without selenium grid
  • Test Results integration with test management tools
  • Integration with continuous integration/build automation systems.
  • Locale support
  • Flexible data provider for data driven tests
  • Auto retry analyzer for failing tests
  • Descriptive report

What is the use of listeners?

The general idea is that one or more objects (the listeners) register their interest in being notified of command execution on selenium/webdriver/webelement. The listener can perform some actions or track details before/after command execution as well as on failure. You can create listener by implementing appropriate listener interface of by extending adaptor class. To register listener set property “wd.command.listeners” for web driver listener and “we.command.listeners” for web element listener.

A simple but very useful example of listener is “listener for sendkeys”. As you know in webdriver send keys will append the text box, so each time we need to first call clear command and then use send keys command.

Without listener

firstName.clear();
firstName.sendKeys(“fname”);
lastName.clear();
lastName.sendKeys(“lname”);

With listener

firstName.sendKeys(“fname”);
lastName.sendKeys(“lname”);

 

Listener for above requirement can be implemented as below:

public class SendKeysListener extends IsWebElementCommandAdapter {

@Override
public void beforeCommand(IsExtendedWebElement element, CommandTracker commandTracker) {

if (commandTracker.getCommand().equalsIgnoreCase(DriverCommand.SEND_KEYS_TO_ELEMENT)) {
element.clear();
}

}

}.

How multiple parents supported in page hierarchy?

What is the purpose of page locator and how to use it?

How can I implement dynamic page flow using page hierarchy design?

Consider the following case where page flow is configurable in AUT.

According to flow one page flow is Review Page -> Passenger Page – > Payment Page

Another possible flow is Review Page -> Payment Page.

Blow sample shows you the implementation for such case.

public class ReviewFlightPage extends WebDriverBaseTestPage<ReviewPage>

implements PaymentLocators, PaymentsPageLauncher {

}

public class PassengerPage extendsWebDriverBaseTestPage<ReviewFlightPage>

implementsPaymentLocators, PaymentsPageLauncher {

}

public class PaymentPage extendsWebDriverBaseTestPage<PaymentsPageLauncher>

implementsPaymentLocators{

protecte void initParent() {

this.parent= (pageProps.getInt(“review.next.flow”) == 6)

? new ReviewFlightPage()

: new PassengerPage();

 

}

}

What is self-descriptive locator?

Locator is used for locating the element on the page. In addition, using self descriptive locator you can provide description of the locator/element as well. The description will be used in different assertion/verification messages.

String LOGOUT_LINK_LOC = “{‘locator’:’css=a.logout’,’desc’=’Logout link’}”;

 

How can I create custom component/element?

Custom component can be created by extending Component class.

public class TestComponent extends Component {

public TestComponent(String locator) {

super(locator);

}

….

}

Custom component can be used in page class as below.

@FindBy(locator=”locator”)

TestComponent testComponent;

@FindBy(locator=”locator”)

List<TestComponent> testComponent;

 

How can I use existing driver session?

Following are the steps:

1. Webdriver session can be created through. After starting session you can perform manual steps on the browser!

2. You need to use only appropriate remote driver for this purpose. (e.g. firefoxRemoteDriver)

3. You need to provide session id by setting a property “webdriver.remote.session”. The session id can be found at from where you had created session.

How can I make a test Data driven?

To make any test data driven you can use IsDataProvider annotation on test method. You can provide data in CSV, JSON, MS-Excel file or from database.

@IsDataProvider(dataFile = ” resources/data/searchText.csv “)

@IsDataProvider(dataFile = “resources/data/searchText.json”)

@IsDataProvider(dataFile = “resources/data/testdata.xls”)

@IsDataProvider(dataFile = “resources/data/testdata.xls”, sheetName=”TC2″)

@IsDataProvider(dataFile = “resources/data/testdata.xls“, labelName=”TC2″)

@IsDataProvider(sqlQuery = “select col1, col2 from tbl”)

 

To configure using property

global.testdata=[<param>=value]

 

global.testdata=dataFile = “resources/data/${class}/${method}.csv”

global.testdata=dataFile = “resources/data/testdata.xls”; sheetName=“${class}“;labelName=“${method}”

global.testdata=dataFile = “resources/data/${class}.xls”; sheetName=“${ method }“

 

In above example you can notice ${class} and ${method} parameters are used which you can use as per your requirement.

To set data provider parameters for individual test method you can provide property as below:

<tc_name>.testdata=[<param>=value]

 

TC02.testdata=dataFile = “resources/data/testdata.xls”; sheetName=”TC2“

TC01.testdata= sqlQuery = ” select col1, col2 from tbl “

 

How can I provide desired capabilities when using ISFW?

For all driver set property “driver.extra.capabilities=[<capabilityname>=<value>]”

For specific driver set property “<driver>.extra.capabilities=[<capabilityname>=<value>]”

Example:

driver.extra.capabilities=acceptSslCerts=false;platform=WINDOWS

chrome.extra.capabilities=acceptSslCerts=true;chrome.switches=[–ignore-certificate-errors]

 

Is any logging system used in ISFW?

Yes, Apache logging services is used and logger object is available at test level as well as page level. Configuration is provided through log4j.properties file. For configuring logging as per your requirement please refer log4j documentation.

How can I Use Selenium grid with ISFW?

You need to set appropriate server, port and remote driver.

For example you can set following properties in application property file.

selenium.server=<ip or machine name>

selenium.port=<port used by grid/server normally 4444>

selenium.defaultBrowser=firefoxRemoteDriver

 

The same can be provided either by command line as system property or in testNG configuration file as parameter.

How can I run my test on cloud (Sauce Lab)?

Interested in our Testing Services?

Please enable JavaScript in your browser to complete this form.
Checkboxes
By submitting this form, you agree that you have read and understand Apexon’s Terms and Conditions. You can opt-out of communications at any time. We respect your privacy.

Other stories you may enjoy...

One Year In: Technology Success Stories from the Pandemic

This time last year, US companies were forced to face a new and unsettling reality: business as usual was no longer an option. I wrote then about how businesses could shift their...

Healthcare Apps and the Need for Security

One of the most exciting areas in tech right now promises to be “the most personal” ever. A key aspect of making wearable devices like the Apple Watch personal is through...

Developing an App for the 2020 General Election?

Here is a thought: With the UK General Election having just finished, could the next one in 2020 be the first to use a mobile app to allow people to vote? The polling...