MAHI
MAHI

Reputation: 10163

How to run Selenium test from Netbeans

I have built a test case in the Selenium IDE. Now, how can I most simply implement the test case to run from Netbeans?

My Netbeans version is 7.2. Selenium server is running in my Netbeans services. This is my simple test case for a Google search. I have tried to export as a Java/Junit file. Netbeans shows the class path missing.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="https://www.google.co.in/" />
<title>google_search</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">google_search</td></tr>
</thead><tbody>
<tr>
    <td>open</td>
    <td>/</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>id=gbqfq</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=gbqfq</td>
    <td>selenium</td>
</tr>
</tbody></table>
</body>
</html>

Upvotes: 0

Views: 2596

Answers (1)

Manigandan
Manigandan

Reputation: 5082

Open a New java project in your IDE.

Download the Selenium Standalone server here

Put the jar file in the lib and Start to create your Selenium test cases.

If you want to run it on Chrome then download the chromedriver.exe file here

For to run on IE download the IEDriverServer.exe for respective bit version here

Sample code:

 WebDriver driver  = new FirefoxDriver();
 driver.get("URL");
 //Do some actions
 driver.quit();

Upvotes: 1

Related Questions