cancel
Showing results for 
Search instead for 
Did you mean: 

How to control browser using ReadyAPI?

SOLVED
Highlighted
Occasional Contributor

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?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Occasional Contributor

Re: How to control browser using 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()

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

View solution in original post

12 REPLIES 12
Highlighted
Super Contributor

Re: How to control browser using ReadyAPI?

Highlighted
Occasional Contributor

Re: How to control browser using 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()

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

View solution in original post

Highlighted
Super Contributor

Re: How to control browser using ReadyAPI?

@Tush

WebDriver driver=new ChromeDriver()

does that even work?

I am getting exceptions

 

 

Highlighted
Occasional Contributor

Re: How to control browser using ReadyAPI?

Yes @sanj,it works.

Able to run my selenese code in ReadyAPI itself.

 

Follow the above mentioned steps of updating the jars, it should work.

Highlighted
Super Contributor

Re: How to control browser using ReadyAPI?

@Tush

Thanks

I forgot to delete the old jars in regards to gson, guava httpcore and httpclient and that gave me the odd exception

I was able to fire up groovy script and open up chrome.

 

Its interesting how we get odd exceptions and even googling yields no results!

 

Highlighted
Contributor

Re: How to control browser using ReadyAPI?

@Tush @sanj 

 

I wanna to connect with selenium through ready API. So I am following the steps given by you.

 

But I am not able to find those jar in selenium pack which is mentioned by you.

 

Here the screenshots (Capture.PNG and Capture1.PNG) of the jar which I can see in the selenium pack. However, I try to copy all available jars to the bin or bin/ext folder. here is what I got

 

1) When I try to copy all jar files to the bin folder and restart the ready api. I won't see all those jars are loading with Ready API. 

2) Then I try all jars to move to bin/ext folder and restart the ready api again. I can see jars are loaded.

3) Then I execute below code but its throwing error for the last row

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

//Initiate WebDriver
System.setProperty("webdriver.chrome.driver", "C:/Users/Selenium/chromedriver_win32/chromedriver.exe");
log.info(System.getProperty("webdriver.chrome.driver"));

WebDriver driver=new ChromeDriver();

Error

ReadyAPI Log :- 

Wed Jan 23 14:56:20 AEDT 2019:ERROR:An error occurred [com.google.common.util.concurrent.SimpleTimeLimiter.create(Ljava/util/concurrent/ExecutorService;)Lcom/google/common/util/concurrent/SimpleTimeLimiter;], see error log for details

Error Log :-

Wed Jan 23 14:56:20 AEDT 2019:ERROR : An error occurred in the script of the Groovy Script test step [Selenium Connector]:

Wed Jan 23 14:56:20 AEDT 2019:ERROR:java.lang.NoSuchMethodError: com.google.common.util.concurrent.SimpleTimeLimiter.create(Ljava/util/concurrent/ExecutorService;)Lcom/google/common/util/concurrent/SimpleTimeLimiter;

Could you please help me here

Highlighted
Occasional Contributor

Re: How to control browser using ReadyAPI?

Hi ranujn,

Please check the selenium version you downloaded. Try some other version/ link.

PFA: seleniumJar.jpg

Highlighted
Contributor

Re: How to control browser using ReadyAPI?

I downloaded the same version as you mentioned (3.8.0) and copy all the jar to the bin/ext folder as jar files are not recognized if I keep jar files in the bin folder. Still getting the same error message 

 

Error

ReadyAPI Log :- 

Wed Jan 23 14:56:20 AEDT 2019:ERROR:An error occurred [com.google.common.util.concurrent.SimpleTimeLimiter.create(Ljava/util/concurrent/ExecutorServiceSmiley WinkLcom/google/common/util/concurrent/SimpleTimeLimiter;], see error log for details

Error Log :-

Wed Jan 23 14:56:20 AEDT 2019:ERROR : An error occurred in the script of the Groovy Script test step [Selenium Connector]:

Wed Jan 23 14:56:20 AEDT 2019:ERROR:java.lang.NoSuchMethodError: com.google.common.util.concurrent.SimpleTimeLimiter.create(Ljava/util/concurrent/ExecutorServiceSmiley WinkLcom/google/common/util/concurrent/SimpleTimeLimiter;

Highlighted
Occasional Contributor

Re: How to control browser using ReadyAPI?

Hi, did you copy the files to lib folder and check?

Please refer to my solution above.

Thanks

 

Issue.jpg

New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Compete with community members in the TechCorner Challenge and get into the Leaderboard!

Rank Participant Points Earned
1 msiadak 12
2 nmrao 8
3 HimanshuTayal 3
Top Kudoed Authors