Forum Discussion

Tush's avatar
Tush
Occasional Contributor
7 years ago
Solved

How to control browser using ReadyAPI?

Tool: ReadyAPI  2.2.0 (Liscensed)

 

I have a requirement to -
1. Open browser, pass an IP of a machine(Say A)
2. Do some changes in that machine via broswer
3. Run API tests against another system(Say B)
4. After tests are complete, Log back into 'A' via browser to make changes in A.

We use selenium(different IDE) to automate the browser controls of 'A', but are not able to link it to ReadyAPI  to run API tests.

 

Tried this-

https://support.smartbear.com/readyapi/docs/testing/integrations/selenium/integrate.html

 

But couldn't run the script provided

 


Is there a way to automate the entire requirement in ReadyAPI itself?
Can we handle browser automation in readyAPI?

 

  • I followed the link you shared and after some googling and trouble shooting was able to launch the browser.

    Thanks for the response.

     

    Issue-

    Earlier had copied all my selenium jars to bin/ext folder.

    Now i have copied all the selenium jars to lib folder.

    you need to update jars with latest(delete the old jars in that folder) -

    httpcore-x.x.x

    httpclient-x.x.x

    gauva

    gson

     

    Restart ReadyAPI, run following code to open browser-

    *********************************************

    import org.openqa.selenium.*
    import org.openqa.selenium.chrome.ChromeDriver
    import java.util.concurrent.TimeUnit

    //Initiate WebDriver
    System.setProperty("webdriver.chrome.driver", "filePath/chromedriver.exe");
    log.info(System.getProperty("webdriver.chrome.driver"));

    WebDriver driver=new ChromeDriver()


    //Setup Environment
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS)
    driver.get("http://www.apc.com");

    //Your Code
    Thread.sleep(10000)
    driver.quit()

    **************************************

12 Replies

    • Tush's avatar
      Tush
      Occasional Contributor

      I followed the link you shared and after some googling and trouble shooting was able to launch the browser.

      Thanks for the response.

       

      Issue-

      Earlier had copied all my selenium jars to bin/ext folder.

      Now i have copied all the selenium jars to lib folder.

      you need to update jars with latest(delete the old jars in that folder) -

      httpcore-x.x.x

      httpclient-x.x.x

      gauva

      gson

       

      Restart ReadyAPI, run following code to open browser-

      *********************************************

      import org.openqa.selenium.*
      import org.openqa.selenium.chrome.ChromeDriver
      import java.util.concurrent.TimeUnit

      //Initiate WebDriver
      System.setProperty("webdriver.chrome.driver", "filePath/chromedriver.exe");
      log.info(System.getProperty("webdriver.chrome.driver"));

      WebDriver driver=new ChromeDriver()


      //Setup Environment
      driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS)
      driver.get("http://www.apc.com");

      //Your Code
      Thread.sleep(10000)
      driver.quit()

      **************************************

      • sanj's avatar
        sanj
        Super Contributor

        Tush

        WebDriver driver=new ChromeDriver()

        does that even work?

        I am getting exceptions