Selenium Java Automation: Interacting with tabs. Reusing methods and actions.

preview_player
Показать описание
In this video I go over how I created a method to interact with a new tab that is opened when a button or link is clicked using selenium java framework.

if (bcloseTabFlag == true)
{
}

This video also go overs how I reuse methods and actions in a selenium java framework. My framework uses pageobject model that contains element locators and methods. The framework also has 'UserFlow' and 'ElementActions' files that I incorporate into my automation framework. These files allow the framework to reuse user flows (e.g. user flows\business transactions\business process) and element actions (e.g. click buttons, links, set text) that are repeated in other testcases.

UserFlow file contains the user flows\supporting methods\business transactions\business process that make up a set of specific user steps that can be reused in other testcases. e.g. login, opening a file, creating a purchase order

ElementActions file contains the types of actions that can be used and reused on webelements. for example, clicking buttons and links, setting text, verifying text, selecting list items or combobox items. These actions are also 'wrapped' with error handling for each of the actions, if a error occurs than details of the error can be logged along with a screenshot. This file can also contain supplementary methods that support the development of testcases for example, random number or character generators , screenshots methods and random string\char\number generator methods along with string methods such as split.

in terms of object oriented design this framework design will use all 4 types of OO design:
encapsulation, abstraction. inheritance and polymorphism.
The 4 pillars of OO design help reduce programming complexity, effort and maintenance and promotes reusability and development speed in an automation framework.

although this is an example of a automation framework using selenium java concepts and OO design in this video. These concepts can easily be applied to selenium python automation framework (see my other videos).

Encapsulation - wrapping data (variables) and code together as a single unit. All the classes which are written the automation framework are an example of Encapsulation.

For e.g. in the page object model classes where the WebElement locator using @FindBy is declared and initialization of data members will be done using the constructor to utilize those in test methods (test cases).

Abstraction - Process of hiding the implementation details from the user and showing only relevant details to them.

inheritance - One class acquires the instance variables (properties) and functionalities of another class are called inheritance.
When the Base Class in an automation framework is created to initialize WebDriver interface, waits, loggers, reports, etc., and the Base Class in other classes such as Tests and Utility Class. In this case, extending one class into another class is an example of implementing Inheritance.

Polymorphism - allows us to perform a single action in different ways using Method Overloading and Method Overriding.

Method Overloading -Implicit wait can be used with different time stamps such as SECONDS, MINUTES, HOURS, is a example of method overloading

Method Overriding - use a method that was already implemented/written in another class by changing its parameters . findelement is an example of method overriding
Рекомендации по теме
join shbcf.ru