Java 如何在selenium Web驱动程序中自动化SOAP UI

Java 如何在selenium Web驱动程序中自动化SOAP UI,java,selenium,selenium-webdriver,Java,Selenium,Selenium Webdriver,我们有一个应用程序,其中有一个客户模块。 在这里,它将显示在字段下方 客户名称 地址1 地址2 城市 陈述 要在Web页面中获取客户模块中的记录,我们需要在soap UI中提供输入数据,一旦从soap UI执行后,将创建一个新客户并在UI网页中显示。 我们如何通过selenium Web驱动程序自动化这一过程。因此,让selenium和SoapUI合作的最明显也是最简单的方法是: 安装SoapUI 下载Selenium(您需要Selenium-server-standalone-2.*.jar)

我们有一个应用程序,其中有一个客户模块。 在这里,它将显示在字段下方 客户名称 地址1 地址2 城市 陈述

要在Web页面中获取客户模块中的记录,我们需要在soap UI中提供输入数据,一旦从soap UI执行后,将创建一个新客户并在UI网页中显示。
我们如何通过selenium Web驱动程序自动化这一过程。

因此,让selenium和SoapUI合作的最明显也是最简单的方法是:

  • 安装SoapUI
  • 下载Selenium(您需要Selenium-server-standalone-2.*.jar) 并将其放入您的SoapUI安装中(放入
    %SOAPUI\u HOME%\bin\ext
  • 启动SoapUI;启动新项目;创建一个新的测试用例;添加 新沟槽台阶;复制粘贴到步骤中。我犯了一个错误 很少修改:删除
    行,删除
    类
    Selenium2示例
    void main
    行以及结束符 将
    System.out.println
    更改为
    log.info
    。我的期末考试 (完整)测试代码如下
  • 点击播放。您应该看到Firefox启动,导航到 Google,然后您应该会看到SoapUI日志条目
  • 示例代码:

    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()
    

    这个答案是复制粘贴的。

    在我看来,将soapUI与selenium测试套件集成是不值得的。我建议在selenium套件中创建一个类来执行创建用户的服务调用,并将该步骤作为数据设置的一部分。。。即使您还不知道如何做到这一点,学习在selenium框架内进行服务调用所需的时间和精力也会比尝试在selenium测试中使用monkeypatch调用soapui所需的时间和精力要少……您可以创建一些在测试运行之前执行的安装脚本。如果您想使用SOAPUIAPI,可以在这里找到soap客户端的示例,然后查看-@priti的答案如果您认为它解决了您的问题,请给出答案。认识到正确的解决方案将有助于整个社区。这可以通过单击答案旁边的绿色复选标记来完成。见此参考。干杯。伙计们,有人能帮我在EclipseJuno服务发布1中设置Groovy吗。