In this tutorial I will explain you how to download txt, pdf, csv, excel and doc file using firefox profile. You can write a selenium script to download file, if you know the MIME type of the file that you wanted to download.
google_ad_client = "ca-pub-8489590936844748";
google_ad_slot = "7087636712";
google_ad_width = 336;
google_ad_height = 280;
Download File Using Selenium...
Sunday, December 28, 2014
December 28, 2014 by GudReview
In this tutorial I will explain how to click on WebElement using JavaScriptExecutor. Sometimes click() does not work then you can use JavaScriptExecutor to click button or WebElement.
google_ad_client = "ca-pub-8489590936844748";
google_ad_slot = "7087636712";
google_ad_width = 336;
google_ad_height = 280;
Click WebElement Using JavaScriptExecutorimport org.openqa.selenium.By;
import...
Tuesday, December 16, 2014
December 16, 2014 by GudReview
If the WebDriver does not get web element then the WebDriver will wait for specified time and WebDriver will not try to search the element during the specified time. Once the specified time is over, WebDriver will start searching the web element only one time before throwing the exception.
google_ad_client = "ca-pub-8489590936844748";
google_ad_slot = "7087636712";
google_ad_width =...
December 16, 2014 by GudReview
If a particular web element takes more than a minute to load then you may want to wait for the element to load properly and then go to the next line of code. In selenium, it is possible with Explicit Wait.
google_ad_client = "ca-pub-8489590936844748";
google_ad_slot = "7087636712";
google_ad_width = 336;
google_ad_height = 280;
Selenium Explicit Wait Example
import org.openqa.selenium.Alert;
import...
Monday, December 15, 2014
December 15, 2014 by GudReview
This article shows you how to take screenshot using Selenium Webdriver. Screen shot may help you to identify and debug the problem.
google_ad_client = "ca-pub-8489590936844748";
google_ad_slot = "7087636712";
google_ad_width = 336;
google_ad_height = 280;
Take Screenshot Using Selenium Webdriverimport java.io.File;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.By;
import...
December 15, 2014 by GudReview
In this tutorial, I will tell you how to write text in the forms. Selenium webdriver provides a method called sedKeys() which help us to write text in the forms automatically.
google_ad_client = "ca-pub-8489590936844748";
google_ad_slot = "7087636712";
google_ad_width = 336;
google_ad_height = 280;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import...
December 15, 2014 by GudReview
Suppose we have a requirement to drag a webelement from one location and drop in another using a selenium script. In selenium webdriver, we can perform drag and drop or mouse operations by using Actions class.
google_ad_client = "ca-pub-8489590936844748";
google_ad_slot = "7087636712";
google_ad_width = 336;
google_ad_height = 280;
import java.util.concurrent.TimeUnit;
import...
Wednesday, November 12, 2014
November 12, 2014 by GudReview
In this tutorial, I will tell you how to delete cookies -
1. We need to create an object of cookie and pass the cookie name and value to the cookie's constructor as an argument.
2. Add cookie using selenium webdriver.
3. Now delete cookies using selenium webdriver.
google_ad_client = "ca-pub-8489590936844748";
google_ad_slot = "7087636712";
google_ad_width = 336;
google_ad_height...
November 12, 2014 by GudReview

In this tutorial, I will tell you how to add cookie -
1. We need to create an object of cookie and pass the cookie name and value to the cookie's constructor as an argument.
2. Now add cookie using selenium webdriver.
google_ad_client = "ca-pub-8489590936844748";
google_ad_slot = "7087636712";
...
November 12, 2014 by GudReview
A cookie is a small file stored on the client computer by the server. If the user requests a web page then the server uses cookie information to identify the user. With selenium, you can create, get and delete cookies.
1. Create cookie - There are several ways to create cookie.
a) Cookie name = new Cookie("cookieName", "cookieValue");
...
Tuesday, November 4, 2014
November 04, 2014 by GudReview
A JavaScript prompt box is used when you want the user to enter a value before going to a page.
When a prompt box pops up, the user will have to enter a value by using WebElement sendkeys("String str") methond and then click either "OK" or "Cancel" to proceed after entering an input value.
If the user clicks "OK" the prompt box will return the value. If the user clicks "Cancel" the box returns...
November 04, 2014 by GudReview
A JavaScript confirm popup box is used when you want the user to verify or accept something. In confirm box, the user can click either "OK" button or "Cancel" button to proceed.
If the user clicks on "OK" button, the confirm popup box will return true. If the user clicks on "Cancel" button, the confirm popup box will return false.
google_ad_client = "ca-pub-8489590936844748";
google_ad_slot...
November 04, 2014 by GudReview
A JavaScript alert box is used to provide some information to the user. Alert box provides only "OK" button. So, the user will have to click "OK" to proceed.
google_ad_client = "ca-pub-8489590936844748";
google_ad_slot = "7087636712";
google_ad_width = 336;
google_ad_height = 280;
JavaScript Alert Box
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.Alert;
import...
November 04, 2014 by GudReview
JavaScript alert, confirm and prompt popup is an web element. To handle JavaScript alert, confirm and prompt popup, Selenium comes with Alert interface.
Selenium Alert interface provides methods to
1. Click "OK" button
2. Click "Cancle" button
3. Get text from popup boxes
4. Enter text to popup boxes
Alert Interface & It's Methods
google_ad_client = "ca-pub-8489590936844748";
...
November 04, 2014 by GudReview
Frames is a web page within another web page. A web page can have one or more frames.
Each frame has its own unique numeric id and name. Selenium WebDriver uses this unique id or name to switch control between frames.
google_ad_client = "ca-pub-8489590936844748";
google_ad_slot = "7087636712";
google_ad_width = 336;
google_ad_height = 280;
Syntax -
1. driver.switchTo().frame(int...
November 04, 2014 by GudReview
Web page may have multiple windows. Multiple windows means a link on a web page of another web page. Current web page is called main window and other windows called child window.
Each window has its own unique alphanumeric id. Selenium WebDriver uses this unique id to switch control between multiple windows.
google_ad_client = "ca-pub-8489590936844748";
google_ad_slot = "7087636712";
...
Friday, October 31, 2014
October 31, 2014 by GudReview
In this tutorial, We will learn how to go forward to the next web page.
Forward To The Next Web Page
1. Go to "http:// www.facebook. com".
2. Click on forgot password link.
3. Come back to "http:// www.facebook. com".
4. Now forward to the next web page (i.e forgot password page).
google_ad_client = "ca-pub-8489590936844748";
google_ad_slot = "7087636712";
google_ad_width =...
October 31, 2014 by GudReview
Suppose we are in login page and then we clicked on forget password link. Now we are in forget password page and we want to go back to the login page.
Let's see how can we go back to the previous web page.
driver.navigate().back() - This command is used to go previous page.
google_ad_client = "ca-pub-8489590936844748";
google_ad_slot = "7087636712";
google_ad_width = 336;
google_ad_height...
October 31, 2014 by GudReview
Sometimes we need to refresh the current web page to reload or to get the new dynamic value.
driver.navigate().refresh() - This command is used to refresh the current page.
Refresh Current Web Page Example
google_ad_client = "ca-pub-8489590936844748";
google_ad_slot = "7087636712";
google_ad_width = 336;
google_ad_height = 280;
import org.openqa.selenium.By;
import...
Tuesday, October 28, 2014
October 28, 2014 by GudReview

In this tutorial, I will show you how to resolve WebDriver Exceptions.
1. Firefox - You may have faced org.openqa.selenium.firefox.NotConnectedException error.
To resolve this error, we need to download new version of Selenium. You can download Selenium from "http:// docs.seleniumhq. org/download/" and then...
Monday, October 27, 2014
October 27, 2014 by GudReview
In my earlier posts, we have learned WebDriver's Drivers, WebDriver's Commands. In this tutorial, we will learn how to navigate on specific page or URL.
1. get(String URL) - This method will load a web page of given URL in the current browser.
Example: driver.get(“www.google.com”);
2. driver.navigate().to(String URL) - This method will load a web page of given URL in the current browser.
Example:...
October 27, 2014 by GudReview

Let's see how to list excepted exceptions that a test method can throw. If the test method throw no exception or throw other than excepted exceptions then the test will be marked a failure.
In the below example, there are two test methods -
1. exceptionTest - This test method result will be pass because the...
Saturday, October 25, 2014
October 25, 2014 by GudReview

In this tutorial, We will see how to set maximum time for test case execution. If the test case takes more time than the specified time to finish then the TestNG will market it as failed.
To set maximum time for test case execution, we use timeOut attribute of @Test annotation.
google_ad_client = "ca-pub-8489590936844748";
...
October 25, 2014 by GudReview

In this tutorial, we will see how to ignore test case. Sometimes, We need to ignore test cases. In this example, We will ignore WorkflowTest test case.
TestNG comes with annotation @Test and attribute "enabled". We need to make enabled equal to false.
google_ad_client = "ca-pub-8489590936844748";
...
Thursday, October 23, 2014
October 23, 2014 by GudReview

In this tutorial, I will list out Selenium WebElement methods. WebElement in a web page is nothing but a text box, button, links, checkbox, radio button, table, window, frames etc.
Selenium WebElement Methods
1. clear() - This method is used to clear the value of text box.
Example: driver.findElement(By.name(“username”)).clear();
2....
October 23, 2014 by GudReview

In this tutorial, I will list out Selenium WebElement locator. WebElement’s locators used to find all WebElements within a web page.
Selenium WebElement Locator
1. findElements() - This method is used to find all WebElements within a web page with same locator.
Example: List<WebElement>...
October 23, 2014 by GudReview

WebDriver is an interface in Selenium. WebDriver provides a set of methods that we use to automate web application for testing purpose.
1. get(String URL) - This method will load a web page of given URL in the current browser.
Example: driver.get(“www.google.com”);
2. getCurrentUrl() – This method will...
October 23, 2014 by GudReview

Selenium WebDriver’s driver (i.e. browser driver) is required to make a direct calls to the browser using browser’s native support for automation.
In selenium, FirefoxDriver, InternetExplorerDriver, ChromeDriver and HtmlUnitDriver is a class which implements WebDriver interface.
Selenium WebDriver’s Driver...
October 23, 2014 by GudReview

TestNG provides “@Test” annotation along with attribute “dependsOnMethods”. There may be a requirement to make a test case to depends on other test cases. To make a test case to depends on other test cases, we need to use dependsOnMethods attribute with @Test annotation.
DependsOnMethods Testng Example
...
October 23, 2014 by GudReview

We need to set priority of test cases to execute test case in a particular order. If we do not set priority of test cases then we are not sure the order of execution of test case (i.e. Logout test case may run or execute before Login test case).
Steps to test an application
1. Login
2. Workflow
3. Logout...
Thursday, August 21, 2014
August 21, 2014 by GudReview

In this tutorial, I will tell you how to configure Selenium with eclipse. Before you configure Selenium with eclipse, You should be sure that you have installed TestNG plugin with eclipse. Click here to know how to install and configure TestNG with Eclipse.
Steps To Configure Selenium With Eclipse
1. First...
Thursday, August 14, 2014
August 14, 2014 by GudReview

In this tutorial, I will introduce you with TestNG annotations list. TestNG acts as a controller. TestNG controls the flow of execution of code with the help of annotations.
TestNG Annotations List
Annotations Description
@BeforeSuite The annotated method will run before all test methods run in this...
August 14, 2014 by GudReview

In this tutorial, I will explain you TestNG installation in eclipse. TestNG comes with Eclipse plug-in that allow you to write and run TestNG tests from Eclipse in a convenient way. Before TestNG installation and configuration, you should be sure that the eclipse and java jdk 5 or higher has installed on...
Subscribe to:
Posts (Atom)