Tuesday, October 8, 2013

Webdriver: RobotFramework with Java - Part 1

There are so many posts available which states how to install/setup and configure robotframwork in python, however i didn't find any good posts which states how to configure robotframework in Java. So decided to write a blog.

Install/Setup Robot Framework 

To run webdriver test with RoboFramework in java you require following two jar files. 

Download the above two files and put that into some directory. 

Sample Test Case

Create the testcase.txt as mention below into the same directory in which you downloaded JARs
***Setting***
Library    Selenium2Library

*** Test Cases ***
Get Current Browser Test
    Open Browser  http://google.com

Run Test Case

To run the RobotFramework test case you need to set the CLASSPATH. Please add above jar files into your classapth and run the following command 
java org.robotframework.RobotFramework run testcase.txt

Verify Results

Results will be located into same directory in which you have created test case. 

11 comments:

KALYAN CHERUKURI said...

The browser has not launched while running the above testcase. txt ..The script has failed..Could you please provide me the robot framework documentation for beginners.

Gaurang shah said...

@cherukuri would you let me know what kind of error message you are getting ?

Suresh Vemuri said...

Thanks Gaurang, I just ran successfully!

@Cherukuri,
Did u set the classpath for those 2 jars?

Suresh Vemuri said...

@Gaurang shah,
Need your help!
I am a Webdriver +JAVA+Eclipse automation tester. Don't know Python.
Now, learning Robot framework.

Very much confused how to use Robot + Selenium + Eclipse.
I did what you suggested and the small test ran fine.
Googled many forums, but nothing was clear about these points.

I want to use Robot +Selenium +Java + Eclipse - Is this possible?
Or, we don't need Eclipse?

Some says I should install Python, some says Jython??? Though without installing these, I could run the small test above.
What is the way to run tens of test as we do with WebDriver.

Thanks in advance for your time!







Gaurang shah said...

@chekrui,

If you really want to use Robot Framwork I would suggest learn python, it's easy if you know java. The reason is, with Java developing custom keyworkd for robot framework ain't easy.

Suresh Vemuri said...

Thanks for your help Gaurang!
I googled and tried in many ways, but still not clear how to achieve my task.
I am struggling with - how to start Java+Robot Framework.

If you can point to some website for this BASIC stuff, I can learn.
Or, if you can give even a single line of code java + Robot Framework - That is great for me!
For this:
1. Should I install Python. (I installed Robotframework through eclipse-->)
2. What are the Jars I should place in the build path.
3. How can I write my own keywords, and how I can associate them with Robot.

Just basic steps that are related to the set-up are needed.

Thanks

Divya R said...

Hello may i know how to add classpath. im unale to run scripts

S Nadarajan said...

Hi,
While reading robot framework with i got confused and not finding solution how to use robot framework with java. I have installed python and downloaded jar files while executing i got this message.
testcase.txt
***Setting***
Library Selenium2Library

*** Test Cases ***
Get Current Browser Test
Open Browser http://google.com

Error message:No keyword with name 'Open Browser' found.
Could you please help to solve this.

shruti RS said...

can u show an exapmle for automatiing telnet session through robotframework

shruti RS said...

can u show an exapmle for automatiing telnet session through robotframework

DISHA MUNSHI said...

While executing I got an error saying "Testcase contains no keywords" Please help

Post a Comment