Did you ever think,when you give a command driver = new FirefoxDriver(); How the browser was invoked? How come it invokes the version of the browser without adding any extensions to it? If this strikes your mind,here you can see the workflow.
Basics
Test Case Grouping using TestNG ‘Groups’ Annotations
TestNG allows us to group several tests together. You can group certain tests based on what behavior/aspect they are actually testing. You may have a scenario where few tests belong to a certain group(say Regression) and other ones belong to other group(say Sanity) and yet another one belong to other group(say Login). With this approach you may decide to execute only certain group of test and skip other ones(let’s say there was a regression on related code, so we prefer to only execute Sanity related tests).The group test is a new innovative feature in TestNG, it doesn’t exist in Junit framework
Browser Compatibility Testing using Selenium and TestNG
Cross Browser Testing : Is to check that your web application works as expected in different browsers.If we are using Selenium WebDriver, we can automate test cases using Internet Explorer, FireFox, Chrome, Safari browsers.To execute test cases with different browsers in the same machine at same time we can integrate TestNG with Selenium WebDriver.
Executing the Testcase using TestNG.xml file
Lets execute your testcases using testng.xml. This is really helpful when you would like to execute only desired testcases,browser compatibility / parallel testing.
Create a java class file name Testng.java
Using Keys Method to Perform Keyboard Actions in Suggestions List Box
There’s always a need to perform keyboard actions in Suggestion List.For that purpose we can use this ‘org.openqa.selenium.Keys’ method. Here I am sharing the Code, how to do it.
Taking Screenshot Using Webdriver
In selenium webdriver, we can take the screen shot using the below command.
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
Continue reading
Set Browser Width and Height in Selenium Webdriver
Selenium WebDriver allows resizing and maximizing window natively from its API. We use ‘Dimension’ class to resize the window.
Lets take the help of Selenium WebDrivers Dimension Class and declare object say ‘d’ by initializing it with width and height as 420X600 as shown below:
Remember, We need to import the statement ‘import org.openqa.selenium.Dimension’
Mouse Hover Actions in Selenium Webdriver
In order to perform a ‘mouse hover’ action, we need to chain all of the actions that we want to achieve in one go. So move to the element that which has sub elements and click on the child item. It should the same way what we do normally to click on a sub menu item.
Continue reading
Implicit and Explicit Waits in Selenium
Why are waits required in selenium?
In web automation waits are required as certain elements get loaded on the page asynchronously, so after triggering an event a page may get loaded successfully but some of its element may still not get loaded. This causes elementNotFound exception while locating the element. In such cases we are left with using Thread.sleep() i.e. a static wait that will halt the test execution for some specified time and than perform the next step. As Thread.sleep() will wait for the specified time no matter if the elements gets visible before that time. So, using Thread.sleep() is never advisable in UI automation.
Continue reading
How To Read Data From NotePad Using Webdriver
This post helps you to Read Data from Notepad.This is so simple.By using two classes FileReader,BufferedReader we can read data.