Posts

Actual differences between Explicit and Implicit Waits

Hi All, As i have already mentioned the differences Explicit and Implicit Waits in my earlier post but now we will see the actual results. there will be two conditions we can think of it what will happen if implicit wait is greater than explicit wait OR  implicit wait is lower than explicit wait lets see what will happen Condition 1: implicit wait is greater than explicit wait            implicitlyWait = 10 seconds             explicitWait = 2 seconds             ///////////////////////////////////////             public static void main(String[]args) {             FirefoxDriver driver = new FirefoxDriver();             driver.manage...

WebDriver | Automation | launch/Execute on different version of Firefox

Image
Run tests on specific Firefox version | Selenium Firefox binary Imagine a situation where you have to test your web application against two different versions of the Firefox browser. By default, when you instantiate FirefoxDriver, the Firefox version that is available on the PATH variable is launched. But if you want to launch a different version of Firefox, we need to use Firefox Binary. For this first steps you have to install all the versions of Firefox which you want to test on your system. Make sure the installed Firefox versions on different path locations using Custom installation Installing multiple versions of Firefox Suppose you have already installed the Firefox( version 22 ) means default Firefox is already installed. this can be found on your program file location like this.. "C:\Program Files (x86)\Mozilla Firefox" Now we have to install another Firefox version (lets take Firefox version 23 ). 1. Download this version from Mozilla s...

WebDriver Event Listeners

Image
WebDriver Event Listeners Selenium WebDriver provides a very good framework for tracking the various events that happen while you're executing your test scripts using WebDriver. Many navigation events that get fi red before and after an event occurs (such as before and after navigating to a URL, before and after browser back-navigation, and so on) can be tracked and captured How it works? The Listeners use to listen for the events in the registered webdriver.  It can be any type of event or action. Say, page navigation, element click, changing values in a text field (analogy to javascript onXYZ () series methods) and even exceptions. To enable this feature, Create our own user defined Event listener class Create an EventFiringWebDriverobject by means of webdriver instance, And register the Listener to the EventFiringWebDriver instance. How to create your own event listener classes: You can create a  event listener class in tw...

Webdriver/Selenium Difference between methods .isDisplayed() and .isEnabled()?

Image
Hi All, I have seen so many posts where people asked the differences between .isDisplayed() and .isEnabled() in Selenium/Webdriver automation and found mostly people are still confused. The methods .isDisplayed() and .isEnabled() have nothing in common.  Here I am trying to explain the read differences between .isDisplayed() and .isEnabled(). As name itself clearly says .isDisplayed() means is my object are visible or not on my webpage means Am I able to see my element through my eyes. Method   . isDisplayed()   : An element is considered   displayed   when it is perceptually visible to the human eye. The  element displayed  algorithm is a boolean state where true signifies that the element is displayed and false signifies that the element is not displayed. To compute the state on  element : ·          If the attribute  hidden  is set, return false. ...

XPath unable to find text with   or   using webdriver /

Hi, Some times we face issues to create XPath of  WebElement which have space in starting of it and then we check the element html source where we found &nbsp; or &nbsp is added before the element text while it display as space on UI. Normally we create the XPath to identify this element by adding space in the starting of it but his will not identify the element. There are another workaround to identify this element by contains text method. But if we have to identify the element with exact text having starting space or ending space  then we can use following way to do this. lets see this example <div class="myclass"> <label>AgendaShowCapacity &nbsp; </label> </div> OR <div class="myclass"> <label> &nbsp AgendaShowCapacity</label> </div> Following XPath will not work for this //label[text()='AgendaShowCapacity&nbsp;']  doesn't work Here we have to use follow...