Posts

Showing posts from January, 2019

LOCATING AN ELEMENT

Image
Locators There are different locators that are used in selenium to locate an element, Any element can be stored using WebElement interface. The locators used are: ID Name Link Text Partial Link Text Xpath CSSSelector Let us discuss them in detail: How can we locate an element by ID? we are trying to book a flight ticket from Yatra.com website. To book, we need to search a flight & while searching a flight, we need to provide the details of From, To, Depart, Return and Passenger count. If we need to automate this functionality, we can identify these elements using the ID. Please find the screenshot below: From the above screen you can see that the element 'From' can be detected by its ID 'BE_flight_origin_city'. So to detect the element, we write: WebElement element = driver.findElement(By.id("BE_flight_origin_city")); Here driver is an instance of 'WebDriver' interface. How can we locate an element by 'Name...

BEGINNING WITH SELENIUM

Image
The 'WebDriver' Interface The WebDriver interface is used as a reference to its browser class. Following image is the Hierarchy of WebDriver. SearchContext is a top most interface. The methods in this will be abstract as SearchContext is an interface. WebDriver is also an interface which extends SearchContext. WebDriver has nested interfaces names Window, Navigation, Timeouts etc. These interfaces are used to perform specific operation like back(), forward() etc. RemoteWebDriver is a fully implemented class which implements Webdriver, Javascript Executor and TakesScreenshot. As this class is fully implemented class, which means it defines body for all inherited methods. Then we have browser specific driver classes like ChromeDriver(), EdgeDriver(), FirefoxDriver() etc. To execute the tests with Mozilla Firefox browser we generally write WebDriver driver = new FirefoxDriver(); To execute the tests with  Google Chrome  browser  we generally write WebD...

SELENIUM

Image
Why Selenium? There are many functional test tools available as we have already discussed before. We prefer selenium over other testing tools because of the following reasons: It is an open source tool, hence zero cost.  It supports many programming languages (i.e., Java, C#, Ruby, Phython etc.) As many people use Selenium tool today, large number of communities exists for help. Selenium’s Tool Suite It consists of multiple tools as discussed below: Selenium IDE Selenium IDE (Integrated Development Environment) is a Firefox and chrome plugin, with an easy to use interface. It is record and play tools, where user records an action in the web page, store it and play the same tests with new values to it. User can export them as a reusable script in one of many programming languages. Selenium 1 (also known as Selenium RC or Remote Control) Selenium RC was the main Selenium project for a long time, before the WebDriver was brought up in Selenium 2, the newest and...

INTRODUCTION TO TEST AUTOMATION

Introduction In the world of Software testing, Test Automation is the use of a external tool that can control the execution of a test case and can compare the actual result with the expected/predicted result. Sometimes, Regression testing of an application becomes time consuming and laborious when it comes to a release and with every release the count of regression test case increases. A manual approach might not always be effective in finding certain classes of defects. To mitigate such issues, we now-a-days offer test automation  as a possibility to perform these types of testing effectively. Once automated tests have been developed, they can be run quickly and repeatedly. This can be a cost-effective method for regression testing of software products that have a long maintenance life. Test Automation is applicable to GUI and API. Following are the types of testing that we mainly prefer to Automate: Unit Testing, Performance Testing, Security Testing Functional Tes...