Skip to main content

Posts

Showing posts from 2020
Reading the data from a text file in Java and Selenium : There are two approaches where we can get the data from the text file that is file reader and buffered reader  this class allows us to get the data from the text file with the methods of its implementation like read() and readline() Code: Which can read the data character by character using the method read() public class filereader_character { public static void main(String[] args) throws Exception { FileReader reader = new FileReader("E:\\eclipseprojects\\Demoprojects\\seleniuminterviewQA\\testfile\\test.txt"); int character; while((character = reader.read()) != -1) { System.out.print((char) character); } reader.close(); } } Code: Which can read the data by string line using the method readline() public class filerreader_lines { public static void main(String[] args) throws IOException { FileReader reader1 = new FileReader("E:\\eclipseprojects\\Demoprojects\\seleniuminterviewQA\\testfil

Selenium Locators

What are locaters in selenium  Locators in Selenium are one of the most required and important commands. Because they are building block of automation scripts  It helps to locate the GUI elements through which multiple user actions can be performed.  Using the right locator ensures the tests are faster, more reliable or has lower maintenance over releases Incorrect locators may lead to automation failure  Types of locators ID Name ClassName Tag Name Link Text and Partial Link Text  CSS Selector  Xpath  Ways to find the locators in Browsers Firepath, Firebug addons for firefox browser  ChroPath Direct method using f12 – developer tools  How to pass the locators in Automation  Locating elements in WebDriver is done by using the method findElement(By.locator()) findElements(By.locator()) Watch the Tutorial on Youtube: 

Selenium introduction

Selenium introduction and its components: Selenium was created by Jason Huggins in 2004. An engineer at ThoughtWorks, he was working on a web application that required frequent testing. First tool was named as “JavaScriptTestRunner” later named as “Selenium Core” Selenium is a functional automation tool for web applications Selenium is an open-source Selenium can support multiple languages like HTML, java, python, ruby, Perl, PHP and C# Can support multiple browsers like IE, Google Chrome, Mozilla Firefox, Safari and Opera Supports the Operating systems like Windows, Linux, and Mac. Selenium is mainly built-in 4 Components Selenium IDE (Integrated Development Environment) Selenium RC (Remote Control) Selenium WebDriver Selenium Grid Selenium IDE (Integrated Development Environment): Selenium IDE is a simple record and playback tool which comes as an add-on for Mozilla Firefox only. Test cases written in IDE can be ex