hashset and linkedhashset differences in java

Differences between HashSet and LinkedHashSet in Java:   S.No HashSet LinkedHashSet 1 HashSet doesn’t maintain insertion order. LinkedHashSet maintains insertion order. 2 Unordered. Order is unpredictable when we iterate through the elements. Ordered and gives predictable output. 3 If you don’t want to maintain insertion order and should have unique values then you can use… Read More »

How to take screenshot using Selenium WebDriver

Taking screenshot using selenium is simple and it helps us to debug the failure and to find out the root cause. By looking at screenshot, we can get to know the details why and at which step test has failed. TakesScreenShot interface is used to achieve this task and this TakesScreenShot capability is enabled by… Read More »

How to select a dropdown using selenium web driver

In this article, we are going to learn about how to select a drop down using selenium webdriver. In our selenium automation, we may come across situations like entering text, selecting radio buttons and check boxes etc. Like this way, selenium handles dropdowns in an easy manner. Points to remember: Using selenium web driver, we… Read More »

TestNG annotations

Below is the list of annotations in TestNG. @BeforeTest @AfterTest @BeforeMethod @AfterMethod @BeforeSuite @AfterSuite @BeforeGroups @AfterGroups @BeforeClass @AfterClass @Test @BeforeTest: Executes before any method in a class which is having @Test annotation. @AfterTest: Executes after any method in a class which is having @Test annotation. @BeforeMethod: Executes every time before any test method in a… Read More »

Implicit and Explicit wait in Selenium

During automation script development, its common that at least once in their test execution, their scripts have failed due to WebDriver couldn’t able to find element in the web page. This issue can be resolved by using selenium wait conditions appropriately. Page load speed depends on the how fast the response is coming from web… Read More »

How to handle mouse hover events using Selenium WebDriver

In this article, we will learn about how to handle the mouse hover events using selenium webdriver. Firstly, we have to hover mouse over the menu item. This displays the dropdown list/sub menu items. Next, we have to select the sub elements from the list and have to click on one of the sub element.… Read More »

encapsulation in java

Encapsulation in java: Encapsulation = Data Hiding + Abstraction. It means if any component is following Abstraction as well as data hiding then it is also following Encapsulation. Encapsulation: It is actually the process of binding data members and methods together in a unit. Each class in java itself is an example of encapsulation. It… Read More »

general selenium questions

1. Find element using xpath and cssSelector. Html code: <a class=”shopicon relative”>Shopping</a> Solution:  //a[@class=’shopicon relative’]   –> using xpath in firefox .shopicon.relative   –> using cssSelector in chrome //a[text()=’Shopping’] –> text() method 2. In the “in.rediff.com” website, ways to find NEWS link are: Using cssSelector: .navbar>:nth-child(1)>:nth-child(2) .navbarul>:nth-child(2) Using xpath: //a[text()=’NEWS’]   Related articles: Waits in Selenium WebDriver

TestNG

TestNG is a test automation framework emerged to overcome the limitations of both JUnit and NUnit. It has many new features which are more powerful and easy to use. Annotations. Multithread safe tests. Data driven testing. Parameterization support. TestNG supports a different variety of tests like unit, integration, system, functional and end to end. Setup… Read More »

Selenium

Introduction: Selenium Tutorials: Selenium is a free and open source test automation tool for testing web applications. Selenium can be installed on most of the operating systems like Windows  Linux  Apple iOS   etc. Cross browser testing is possible using selenium i.e., we can run the test scripts in different browsers like Firefox  IE  Chrome  Opera … Read More »

Selenium Interview Questions

Selenium Interview Questions: ADP Written test questions: 1. How to find inner text using CSS attribute. Options: css=tag:attribute (“inner text”); etc. 2. How to find words starting with ADP using CSS. Below are the few options. tag:attribute(“starts-with@id, “ADP”); tag:attribute(“@id, “ADP”); etc. 3. A question about Actions element. 4. Context click is used for ? Options:… Read More »

How to handle alerts in Selenium WebDriver

Selenium WebDriver is able to handle alerts in addition to the windows and frames. What is an alert? Alert is a popup or message box which displays on the screen. Alerts can appear on the screen due to various user actions. For example, alert can appear when you click on a button or trying to… Read More »

Difference between while and do while loop in java

Difference between while and do while loop in java: while loop do while loop Checks the condition before executing the statement. It first executes the statement and then checks the condition. Entry controlled loop. Exit controlled loop. Condition comes before the body. Condition comes after the body. Statement(s) are executed at least once. Example: int… Read More »

How to convert string to int in java

In this article you are going to learn, how to convert string to int in Java. parseInt valueOf NumberFormatException 1. Integer.parseInt(): String str = “50”; int num= Integer.parseInt(str); System.out.println(num); Output: 50 Info: It parses the string argument as a decimal integer. All characters in the string must be integers. Otherwise it will throw NumberFormatException. 2.… Read More »

common exceptions in selenium webdriver

1 ElementNotSelectableException: Occurs when an element is not selectable. 2 ElementNotVisibleException: Element is present in the DOM but it is not visible. So WebDriver is unable to interact with the element. 3 NoAlertPresentException: This exception occurs when there is no Alert is present in the DOM. So WebDriver couldn’t be switched to the Alert. 4. NoSuchElementException: Occurs when element is not… Read More »

profiling in selenium webdriver

Firefox options and profiling in Selenium WebDriver: //How to remove log statements in console: System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE,”null”); //Set binary path of a browser FirefoxOptions fo = new FirefoxOptions(); fo.setBinary(“path to exe”); //page load strategy fo.setPageLoadStrategy(PageLoadStrategy.NONE); //or fo.setPageLoadStrategy(PageLoadStrategy.EAGER); //or //Tell selenium to launch specific firefox profile //First, Exit the firefox (Don’t click on cross button to close the… Read More »

auto suggestive dropdown selenium webdriver – Practice question 1

Topic: How to select an option from auto suggestive dropdown in a website. Below code is the solution for the 1st question present in the page. package com; import static org.testng.Assert.fail; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class AutoSuggestionDropdown { static WebDriver driver = null; public static void… Read More »

selenium-interview-questions-2

Selenium Interview Questions: 1. Question on xpath. Parent child traversing. Lets consider we have 1 parent element and 3 child elements. Write a xpath to identify the 2nd child element using 1st child element? Selenium Testing Selenium WebDriver Selenium Automation Solution: //*[@id=’id1′]/following-sibling::li[1] Explanation: If you give the xpath ‘//*[@id=’id1′]‘ in firepath or chropath, 1st child… Read More »

difference between list set and map in java

List, Set and Map are the interfaces which implements Collection interface. Lets discuss the differences between List, Set and Map in Java. List Vs Set Vs Map: 1) Duplicity: List allows duplicate elements. Any number of duplicate elements can be inserted into the list. It doesn’t affect the previous values and indexes. Set doesn’t allow duplicate… Read More »

scroll up and down in selenium webdriver

In this article, you are going to learn how to scroll up or down or horizontally using Selenium WebDriver and java script. Java script executor syntax: 

  We can scroll in the page in below ways. 1 Scroll by Pixel 2 Scroll to the bottom of the page 3 Scroll until the element is… Read More »

Oracle hiring Java developers

Post date: 17-12-2018 Java developers recruitment: Oracle is hiring candidates for Java developer positions. Please check below requirements and apply if your profile matches. Experience: 1-3 years Should have sound knowledge on core java concepts. SQL/PLSQL is an added advantage. Analytical and problem solving skills. Location: Hyderabad   Post date: 19-09-2018 (Expired) Java developers recruitment:… Read More »