FAQ Database Discussion Community


Sum of two variables in RobotFramework

python,automated-tests,robotframework
I have two variables: ${calculatedTotalPrice} = 42,42 ${productPrice1} = 43,15 I executed ${calculatedTotalPrice} Evaluate ${calculatedTotalPrice}+${productPrice1} I got 42,85,15 How can I resolve it?...

Saving class objects in robot framework

python,class,object,robotframework
I am new to Robot Framework. I am writing my own library to work with Robot and I want to save the class object. I want the object to be created and saved once at the suite setup and keep using that same object for the entire test suite. Is...

Robot framework - Test suite output in json format

python,json,robotframework
pybot --output abc.json test.robot The above command renders the output in xml format. Does pybot support getting the summary output in json format? Similarly, does rebot command consolidate the output files that are in json format like, rebot --log log.html --report report.html --output output.json final_output.json ...

Specify which resource file a variable is coming from

robotframework
Robot Framework allows you to import multiple resource files containing keywords with the same names, and to call them using their full name to differentiate between them. For example, if you have Resource1.robot that has a keyword called "Test Keyword" that does some action, and Resource2.robot that also has a...

Can you specify Resource Files in the Command Line call for Robot Framework

robotframework
Can you specify resource files in the command line for Robot Framework similar to variable files? http://robotframework.googlecode.com/svn/tags/robotframework-2.5.5/doc/userguide/RobotFrameworkUserGuide.html#variable-files A lot of our tests use the same resource file and we're trying to see if we can speed up execution by only including the resource file once....

How do I run test cases for a class written in Java, using Robot framework?

java,eclipse,robotframework
I am trying to learn how to use Robot Framework. I created simple Java project, using Eclipse. It contains one package - test and in this package there is only one class - MyKeywords. Here is the class content: package test; public class MyKeywords { public String sayHi(String name) {...

How to create a Java object in my Robot test

robotframework
Is it possible to create an java object in my robot test? I import it like the following: Library my.robot.car Get mile ${carObject} car volvo 2 ${resp}= Call Method ${carObject} GetMiles ${today} [Return] ${resp} So i want to create the Car object in the test, then call the method getMiles....

Want to filter out failure Message from my robot framework output files

python,robotframework
I want to filter failure messages from output files generated after executing my testcases in Robot Framework. I have tried modules like from robot.api import ExecutionResult but it gives me only only count of Passed and Failed Testcases. I have also tried other Robot framework Libtraries like import robot.errors to...

How to access second element using relative Xpath

firefox,xpath,selenium-webdriver,selenium-ide,robotframework
Given this page snippet <section id="mysection"> <div> <div> <div> <a href=""> <div>first</div> </a> </div> <div> <a href=""> <div>second</div> </a> </div> </div> </div> </section> I want to access the second a-element using relative Xpath. In FF (and locating with Selenium IDE) this //section[@id='mysection']//a[1] works but this does not match //section[@id='mysection']//a[2] What...

If ElseIf in Robot Framework

python-2.7,testing,if-statement,automated-tests,robotframework
I want get value from Keyword By use else if. example String text = "" If variable > 5 text = "one"; else if variable <5 text = "two"; else text = "three"; In Robot Framework I use code. ${txt} Set Variable ${txt}= Run Keyword If ${lenght} > 5 Some...

Historical Report Generation Robotframework risto.py

robotframework
When I run the risto.py to generate a historical report (graph), I am getting the following error: #risto.py --output history.png output.xml output1.xml Traceback (most recent call last): File "/usr/local/bin/risto.py", line 505, in <module> Ristopy().main (sys.argv [1:]) File "/usr/local/bin/risto.py", line 428, in main viewer_open = self.plot_one_graph (args) File "/usr/local/bin/risto.py", line 442,...

pybot not making test suite when there is a single case

python,testing,robotframework
I run pybot using this command, pybot --argumentfile a File 'a' has the list of robot test cases and variable arguments as, -v test_type:SUITE /home/sk/a.robot /home/sk/b.robot Now, the test cases are run with ids, s1-s1-t1 and s1-s2-t2. Output.xml contains, <suite id="s1" name="A & B"> <suite source="/home/sk/a.robot" id="s1-s1" name="A"> <test id="s1-s1-t1"...

Robot Framework Test Flow

robotframework,testcase
It's possible to require an execution of a specific test case before the execution of the current test case? My test cases are organized in several folder and it's possible that a test require the execution of the another test placed in the another folder (see the image below). Any...

RobotFramework Convert minutes to hours

robotframework
Is there any built-in library keyword which converts minutes to hours in Robot framework? If not, How can I do that? Eg:5 minutes = 0.0833333 hours I'm new to Robot, any help is appreciated...

How to call list of variables from a resource file into Robot test?

selenium,robotframework
I have 1000 URL names to send to robot test. So that I have planned to assign each URL to a variable called ${ URL1}, ${URL2}... etc. When I use this inside "test.robot" its working as expected. But When I call these variables from resource file I am getting "resources.txt'...

Pybot - redirect test library print statements to the console

python,logging,robotframework
Test.robot, *** Settings *** Library roppie *** Test Cases *** Log Test Robot Print roppie.py, def robot_print(): print "this is a testlib log for robot test - Test.robot" Now, when i run pybot Test.robot, the print statements are printed in log.html. But I am interested in seeing these print statements...

Selenium test fails when using xpath

selenium,xpath,automated-tests,ui-automation,robotframework
I'm using robot framework with selenium2library to make some tests, Here is my test file : *** Settings *** Library Selenium2Library *** Variables *** ${URL_LOCATION} http://localhost:9000/apps/depot/# ${BROWSER_TYPE} chrome *** Test Cases *** Open browser to DEPOT page Open Browser ${URL_LOCATION} Click Element xpath=//div[@class="btn action xlarge nav-next"] The problem is that...

Return a value from a keyword in [setup]

robotframework
In a keyword run in the setup of a test case I have a timestamp which I have to use later in the test case body. What is the best way to return it to the test case body? I have only thought out to use a test-scope variable but...

Robot Framework Regexp

python,regex,robotframework
I have data in the following format name | height | hex assigned [alphanumeric and spaces] | [numeric] cm| [hex]:[hex] 20 char | 5 char | 1 char: 1 char What I'm trying to do is, to match the regexp ${escaped}= Regexp Escape '[A-Za-z0-9_\s] | [0-9]+ cm| [0-9a-f]:[0-9a-f]' Should Match...

how to assign month name a number - Robot Framework

robotframework
I am getting a time stamp by reading a field in my page which has the month name in it like "Feb 28, 2015 12:59". I want to verify which month name it is and assign it the month number. I want to get the date such as "5 28,...

Why can't I switch window on IE with robotframework?

internet-explorer,robotframework,browser-automation
I'm getting an error when switch to popup window. My case: Open Login page . Enter username & password Click Login button (after clicking, display popup window and main window is closed at the same time). Click a button on popup window. .... Here's my script: Open Browser | ${login...

How to write Python custom library for Robot Framework for “doubleclick” and “find icon and type ”?

python,python-2.7,python-3.x,robotframework
I am creating Robot Framework custom Library to do the following steps: STEP 1 : click("firefox_icon.png") STEP 2 : find("email_id.png"), and type("[email protected]") STEP 3 : find("passwd.png"), and type( "[email protected]") STEP 4 : doubleClick("signin.png") Following is the test.robot file contents: ***Settings*** Library calc.Calculator WITH NAME Calculator ***Test Cases*** Click Firefox Icon...

Register Robot Framework listener within Python library

python,listener,robotframework
Robot Framework's Listener feature is great for adding optional pre/post-processing that can be invoked on the command line, e.g. pybot --listener myListener.py mySuite.robot. However, I am creating a Python library for Robot Framework, and I would like to automatically register its listeners without needing to be invoked on the command...

Robot framework - Post run hook to send message

python,robotframework
I run multiple test suites in a single pybot command like this, pybot suite1.robot suite2.robot suite3.robot Now, each one of these robot suites add one key,value into a global dictionary (this test variable contains some metrics that needs to be returned to the test-invoker) as, { "suite1-res" : xxxx, "suite2-res"...

Using multiple libraries in Robot Framework

robotframework
I need to use two libraries in the my tests. Is it possible? If this is possible what is the correct syntax?

How to do some infinite task with Robot Framework?

robotframework
I need to "enable and disable the firewall" continuously using robot framework. I have written following robot testcase for this purpose: testcase1 Open Connection 1.1.1.1 Login test test Write firewall enable Write commit Write firewall disable Write commit The above testcase doing the task as expected but only one time....

Shows error when executing test case using keyword driven approach in Robot Framework

python,robotframework
I am new to Robot framework automation testing.I wrote script and library for simple Quiz application using Python and follows keyword driven approach for test cases. my script is: class Quiz(object): OPTIONS = 'ab' count = 0 def __init__(self): self._score = 0 Quiz.count+=1 def score(self, str1): if str1 not in...

Robot Framework accessing a keyword from test suite Metadata

python,metadata,robotframework
I want to set for each test inside the test suite a simple report of the computer name, So I've created the following simple robot __init__.robot file: *** Settings *** Metadata Executed At Get Environment Variable COMPUTERNAME Library OperatingSystem The problem is that the Get Environment Variable is translated as...

Stopping whole test suite if one specific test case failed

unit-testing,robotframework
I'm trying to stop a test suite from continuing after a specific test case fails. For Example: *** Test Cases *** |Log In | |Perform Valid Login |Test A | |Do A |Test B | |Do B I need to stop the test suite Only if the Log in fails....

How to resolve “NameError: global name 'x' is not defined” error while running Robot Framework testcase using custom Library?

python,python-2.7,robotframework
I am seeing "NameError: global name 'x' is not defined" error while running Testcase in Robot Framework. Following is my custom Library file (Modified as per Bryan Oakley comments): import re def pass_fail_criteria(): if int(re.findall(r"NUM_FLOWS\n-+[\s\S]*?(\d+)\s*-+",x)[0]): return "pass" else: return "fail" Following is the "pass_fail.robot" file contents: *** Settings *** Library...

Is there any way to take a user keyword as a value in a cell in RIDE?

robotframework
I want to use the return value of a keyword as an argument of another keyword. Ex: Should Be Equal [My Keyword] 3 ...

Robot Framework - performing multiple keywords after running keyword if

selenium-webdriver,robotframework
I am trying to execute multiple keywords if a condition evaluates as true. I tried to do something like this *** Test Cases *** | Example *** Keywords *** | Example | | ${title}= Get Title | | Run Keyword If | '${title}' == 'Some Title' | | ... Click...

How does Robot's Telnet library work?

python,testing,robotframework
I've been taking a look at Robot's Telnet library(https://github.com/robotframework/robotframework/blob/master/src/robot/libraries/Telnet.py) and I haven't found an answer in the documentation to this question. I get that The Telnet object handles opening and closing of TelnetConnections, and stores the current connection. But when something like write is called, how does Robot know to...

How to add headers for CreateSession in robot framework HTTP requests library

python,robotframework
I am using the requests library in Robot framework provided at this github link. The documentation implies that if can send custom headers by doing CreateSession <url> headers={'header1':'value1'} .... However, when I do that I get an error "ValueError: need more than 1 value to unpack" This works CreateSession SendCustomHeader...

Robotframework Gherkin - How to log cookies to console?

selenium,robotframework,gherkin
Just started using the Robot Framework to test our application and I really like it so far. The option to combine it with Selenium, Appium and Locust.io in the end sounds appealing. Anyhow, I have a basic question: I'm trying to log the cookies from a browser session to the...

Can Robot Framework Support External Variables?

robotframework,modularity
I am trying to create a central file that houses all the variables that we use in our test cases (for instance, the ${BROWSER} variable). I have also created a central file for a lot of custom defined keywords and I am trying to use the central variable file as...

How to get test cases list in Robot Framework without launching the actual tests?

python,robotframework
I have file test.robot with test cases. How can i get the list of this test cases without activating the tests, from command line or python?...

How to add some external links to ROBOT Framework Test Statistics in log.html and output.xml?

python,robotframework
How can I customize my robot framework log.html and output so that I can add some external links to my output files like log.html and output.xml file.

How to open a command line terminal and execute some commands inside robot framework testcase?

robotframework
I Want to do the following steps: open a terminal of the same ubuntu machine from where my Robot testcase is running and execute some commands. written a Robot framework testcase as shown below: *** Settings *** Library Telnet *** Testcases *** testcase1 open connection 127.0.0.1 write gnome terminal write...

Robot Framework location and name of keyword

python,robotframework
I want to create a python library with a 0 argument function that my custom Robot Framework keywords can call. It needs to know the absolute path of the file where the keyword is defined, and the name of the keyword. I know how to do something similar with test...

Python module does not work as expected, if used as custom keyword in Robot Framework

python,robotframework
If I call this pathon function from console, the dates are calculated as expected: def get_nearest_date(day, month): """Gets nearest date in the future for provided day and month.""" today = date.today() res = "" if (today.month < month): res = str(day) + "." + str(month) + "." + str(today.year) elif...