Posts Tagged ‘standalone driver’

Disclaimer : This post was in my DRAFT for almost 8+ month and i happened to check my blog DRAFTS today hence clearing this. Please do excuse the delay in the response to your queries, i will try to post answers now.

Having worked on selenium tool for almost 4 month and being an addicted soapUI tester, i thought it would be great if both these tool can work together. Lately, after having spent some amount of time i found the way to go for it.

Before starting on integration of soapUI & Selenium, i had to find a common link & it was none other than GROOVY.

Yes, Selenium WebDriver supports groovy & soapUI is having a smooth integration with Groovy. So this is the common factor to go with. So start with the writing the code, download the GROOVY SDK, JAVA SDK, Selenium Standalone Driver & any IDE which support Groovy. Put the downloaded Selenium Standalone driver.jar file into the soapui/bin & soapui/lib folder before executing the  scripts.

Download links : 

Groovy SDK : http://groovy.codehaus.org/Download
Selenium Standalone : http://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.25.0.jar&can=2&q=
JAVA SDK : From Sun/Oracle website, download latest.

My Conclusion :
Best API test tool + Best Web Automation tool = GREATNESS in testing Web API application End to End.

/*
@Author : Pradeep Bishnoi
@Description : .
@GroovyTestStepName : "Launch Selenium"
*/
import org.openqa.selenium.By
 import org.openqa.selenium.WebDriver
 import org.openqa.selenium.WebElement
 import org.openqa.selenium.ie.InternetExplorerDriver
 import org.openqa.selenium.ie.InternetExplorerElement
 import org.openqa.selenium.support.ui.ExpectedCondition
 import org.openqa.selenium.support.ui.WebDriverWait
 import org.openqa.selenium.OutputType
 import org.apache.commons.io.FileUtils
 import org.openqa.selenium.Keys

WebDriver driver = new InternetExplorerDriver()   //This will launch IE, for Firefox use --> FirefoxDriver()

try
{
driver.get("https://learnsoapui.wordpress.com") // Url to be opened
 log.info driver.getSessionId().toString()

 WebElement element = driver.findElement(By.id("s"))
 element.sendKeys("Assertion")

 File f1 = driver.getScreenshotAs(OutputType.FILE)
 FileUtils.copyFile(f1, new File("c:\\screenshot1.png")); // Location to save screenshot

 element.submit()

 driver.getKeyboard ().pressKey (Keys.DOWN)
 driver.getKeyboard ().pressKey (Keys.DOWN)
 driver.getKeyboard ().pressKey (Keys.DOWN)
 driver.getKeyboard ().pressKey (Keys.UP)
 driver.getKeyboard ().pressKey (Keys.UP)
 driver.getKeyboard ().pressKey (Keys.UP)
}
catch(Exception e)
{
log.info "Exception encountered : " + e.message
}