Forum Discussion

Tush's avatar
Tush
Occasional Contributor
8 years ago

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 syst...
  • Tush's avatar
    Tush
    8 years ago

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

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