4

We have an application where we have a customer Module. Here it will displayed below Field Customer Name Address 1 Address 2 City State

To Fetch the records in customer module in a Web page, We need to give the input data in soap UI, once after execute from soap UI, A new customer will created and display in the UI Web page. How can we automate this process through selenium Web driver.

prem
  • 81
  • 1
  • 3
  • 12
  • Integrating soapUI with your selenium test suite is not worth it IMO. I would suggest creating a class within your selenium suite to perform the service call that creates a user and have that step as part of your data setup... even if you don't know how to do that yet, it will take less time and effort to learn to make service calls within your selenium framework rather than trying to do some monkeypatch to call soapui in your selenium test... – Pippo Jun 09 '15 at 12:49
  • You can create some setup script which is being executed before test run. Example of soap client can be found here http://stackoverflow.com/q/15948927/2504101 – olyv Jun 09 '15 at 14:27
  • if you want to use soapui api then have a look at http://stackoverflow.com/questions/16773173/how-to-create-a-soap-ui-project-and-run-requests-to-it-in-java - @priti 's answer – Kavan Jun 09 '15 at 15:11
  • Please [accept](http://meta.stackexchange.com/questions/5234) an answer if you think it solves your problem. It will community at large to recognize the correct solution. This can be done by clicking the green check mark next to the answer. See this [image](http://i.stack.imgur.com/uqJeW.png) for reference. Cheers. – Bhargav Rao Dec 19 '15 at 15:59

1 Answers1

3

So the most obvious, and perhaps the easiest way, to get Selenium and SoapUI to cooperate is:

  1. Install SoapUI.
  2. Download Selenium (you need the selenium-server-standalone-2.*.jar) and drop it into your SoapUI installation (into %SOAPUI_HOME%\bin\ext).
  3. Fire up SoapUI; start a new Project; create a new test case; add a new Groovy step; copy-paste the sample code into the step. I made a few modification: drop the package line, drop the class Selenium2Example and void main lines along with the closing brackets, and change the System.out.println to log.info. My final (full) test code is below.
  4. Click Play. You should see Firefox starting up, navigating to Google, and afterwards you should see the SoapUI log entries.

sample code:

import org.openqa.selenium.By
import org.openqa.selenium.WebDriver
import org.openqa.selenium.WebElement
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.support.ui.ExpectedCondition
import org.openqa.selenium.support.ui.WebDriverWait

// Create a new instance of the Firefox driver
// Notice that the remainder of the code relies on the interface, 
// not the implementation.
WebDriver driver = new FirefoxDriver()

// And now use this to visit Google
driver.get("http://www.google.com")

// Find the text input element by its name
WebElement element = driver.findElement(By.name("q"))

// Enter something to search for
element.sendKeys("Cheese!")

// Now submit the form. WebDriver will find the form for us from the element
element.submit()

// Check the title of the page
log.info("Page title is: " + driver.getTitle())

// Google's search is rendered dynamically with JavaScript.
// Wait for the page to load, timeout after 10 seconds
(new WebDriverWait(driver, 10)).until(new ExpectedCondition() {
    public Boolean apply(WebDriver d) {
        return d.getTitle().toLowerCase().startsWith("cheese!")
    }
});

// Should see: "cheese! - Google Search"
log.info("Page title is: " + driver.getTitle())

//Close the browser
driver.quit()

This answer is a copy-paste from my blog.

SiKing
  • 10,003
  • 10
  • 39
  • 90