How does FirefoxDriver opens the Firefox Browser?

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.

Continue reading

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

Continue reading

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.

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’

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