硒框架用于两个不同的系统相互整合

时间:2015-09-22 14:19:27

标签: selenium-webdriver

我正在使用带有Testng框架的selenium webdriver。我有三个不同的系统,其中第一个系统的输出是第二个系统的输入,第二个系统的输出输入到第三个系统。

第一个系统有自己的UI,只能在Chrome中执行,第二个系统有UI,只能在IE中执行。系统之间的调用是异步的。有人可以帮助设计这个吗?

2 个答案:

答案 0 :(得分:1)

您将为每个浏览器创建3个驱动程序。您将输出保持为变量并传递给其他系统调用。

答案 1 :(得分:1)

您可以在一个脚本中创建多个驱动程序

请参阅以下代码。这只是你需要的一个例子: -

    System.setProperty("webdriver.chrome.driver","./src\\lib\\chromedriver.exe");
    WebDriver driver=new ChromeDriver();
    driver.get("https://www.google.co.in/");
    String output1=driver.findElement(By.xpath("//input[@name='q']")).getText();

    WebDriver driverIE=new InternetExplorerDriver();
    driverIE.get("https://www.google.co.in/");
    WebElement aa= driverIE.findElement(By.xpath("//input[@name='q']");
    aa.sendKeys(output1);

    WebDriver driverMFF= new FirefoxDriver();
    driverMFF.get("https://www.google.co.in/");
    String output3=driverMFF.findElement(By.xpath("//input[@name='q']")).getText();

在上面的演示脚本中,我保存了chromedriver的输出并将其传递给IE

希望它会有所帮助:)