Posts

Showing posts from January, 2013

Selenium WebDriver : How to Handle JavaScript Alerts and Prompts

Selenium 2 provides Alerts API, to work on pop & alert window – // Get a handle to the open alert, prompt or confirmation Alert alert = driver.switchTo().alert(); // Get the text of the alert or prompt alert.getText(); // And acknowledge the alert (equivalent to clicking “OK”)

Setting up Selenium Project Using Maven

Image
We will use Eclipse IDE and Maven for building the Selenium WebDriver test framework. Launch the Eclipse IDE.Create a new project by selecting [File -> New -> Other] from Eclipse Main Menu.On the New dialog, select [Maven -> Maven Project] as shown in the following screenshot:
Click on [Next], the New Maven Project dialog will be displayed. Select the [Create a simple project (skip archetype selection)] check-box and set everything to default and click on the Next button as shown in the following screenshot:
On the New Maven Project dialog box, enter base package name (like com.myproject.app) in Group Id and project name (like myproject) in Artifact Id textboxes. You can also add a name and description but it is optional. Set everything to default and click on the [Finish] button as shown in the following screenshot:

Eclipse will create the myproject project with a structure (in Package Explorer) similar to the one …