robotframework

How to stop Robot Framework test execution if first testcase FAIL?

被刻印的时光 ゝ 提交于 2019-11-30 14:15:45
问题 As shown in below robot file, I have three testcases. I want to stop the test execution, if TESTCASE1 fails. TESTCASE2 should be executed only if TESTCASE1 passes. *** Settings *** Library pythonLib *** Test cases *** TESTCASE1 boot device TESTCASE2 configure device TESTCASE3 restart device Is there any keyword or custom way to do this ? 回答1: There is a command line option for this, if you want the behavior that robot should stop running as soon as any test fails. This option is -

Robot Framework Download File

本小妞迷上赌 提交于 2019-11-30 13:56:13
I use Robot Framework. On my HTML page I have a simple button. When you click on it, it downloads a pdf file. How can I check with Robot Framework if the file has been downloaded ? Tks I found a solution, tks to @ombre42 : ${SERVER} ${SERVER_DEV} ${NAME} Robot ${FILE_NAME} Robot.pdf ${CLASS_NAME} in ${DOWNLOAD_DIRECTORY} C:\\robot_download Scenario: User can download Create Directory ${DOWNLOAD_DIRECTORY} ${CHROME_OPTIONS}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver ${disabled} Create List Chrome PDF Viewer ${prefs} Create Dictionary download.default

How to handle prompt box with Robot Framework?

不羁的心 提交于 2019-11-30 10:31:52
I am using Robot Framework with Selenium2Library for website tests automation. In one of the cases there is a prompt box (pop-up similar to alert, but with an input field in it, see example here ) asking for some text. The problem is Robot Framework can only click OK or Cancel (Confirm Action and Choose Cancel On Next Confirmation keywords) on such pop-ups. So the question is: how can I input some text into the prompt box? Is it possible? In SeleniumLibrary there was a Press Key Native keyword which could press keys without specifying the target element, but it is absent in Selenium2Library.

Robotframework Listener throws “Cannot access execution context” error

一个人想着一个人 提交于 2019-11-30 05:28:36
问题 In order to support an alternative logging format I've started the development of a custom Robotframework Listener. Using the examples in the guide I've been able to replicate the simple PythonListner example. This example can be succesfully run using: python.exe -m robot.run --listener C:\temp\tiny.py -s Test02.Test C:\temp\Test02 The by the listener class generated file contains the different events that have occurred and the functionality is working as it should. When adding the following

How to run headless REMOTE chrome using robot framework

瘦欲@ 提交于 2019-11-30 03:48:27
I'm trying to run chrome headless with my robot framework tests suites. I managed to do it independtly with python using selenium as follows: options = webdriver.ChromeOptions() options.add_argument('--headless') my_driver = webdriver.Remote(command_executer=my_remote_address, desired_capabilities=options.to_capabilities) The following code is what I did in robot but didn't work: ${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver ${options.add_argument}= Set Variable add_argument=--headless Create WebDriver Chrome chrome_options=${options} Open

How to write multiple conditions of if-statement in Robot Framework

旧城冷巷雨未停 提交于 2019-11-29 21:48:57
I have trouble writing if conditions in Robot Framework. I want to execute Run Keyword If '${color}' == 'Red' OR '${color}' == 'Blue' OR '${color}' == 'Pink' Check the quantity I can use this " Run keyword If " keyword with one condition, but for more than one conditions, I got this error: FAIL: Keyword name cannot be empty. And also I would like to use these keywords: Run Keyword If '${color} == 'Blue' AND '${Size} == 'Small' AND '${Design}' != '${Simple}' Check the quantity And Run Keyword Unless '${color}' == 'Black' OR '${Size}' == 'Small' OR '${Design}' == 'Simple' But I just end up

Robot Framework Download File

梦想的初衷 提交于 2019-11-29 19:31:44
问题 I use Robot Framework. On my HTML page I have a simple button. When you click on it, it downloads a pdf file. How can I check with Robot Framework if the file has been downloaded ? Tks I found a solution, tks to @ombre42 : ${SERVER} ${SERVER_DEV} ${NAME} Robot ${FILE_NAME} Robot.pdf ${CLASS_NAME} in ${DOWNLOAD_DIRECTORY} C:\\robot_download Scenario: User can download Create Directory ${DOWNLOAD_DIRECTORY} ${CHROME_OPTIONS}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys,

It errors when specifying the user defined java library into RED robot framework eclipse editor

孤街醉人 提交于 2019-11-29 18:11:54
My requirement is to make use of user defined java libraries in robot framework using RED eclipse editor. When trying to specify library in the robot framework, the system errors as no such library available(shown underline in red for library name). Please correct my mistakes done. I have followed the below steps, Updated Eclipse with RED Editor(Eclipse Neon (v 4.6), RED - Robot Editor v0.7.5) Created a class file just as Project in the same eclipse. (Package name: org.robot.KCCKeywords and Class Name: LogonToKCC) Converted the class file into the type '.JAR' and stored it in jython folder(C:

Nested loop in RobotFramework

▼魔方 西西 提交于 2019-11-29 18:10:25
I need to create a nested loop in Robot framework. Can you please Help me do it? ${contents}= Get File ${file path} @{lines}= Split to lines ${contents} ${matched elements}= Get Webelements ${LABEL PORTAIL XPATH } : FOR ${element} IN @{matched elements} \ ${text}= Get Text ${element} \ : FOR ${line} IN @{lines} \ Run Keyword If '${text}' == '${line}' Log '${text} matched' I need to have a nested loop which compares all the ${text} with all the @{lines} in the file. Thanks in Advance No nested loops in RF; that can be done only by calling a keyword with the inner loop, in the outer one. In your

Centralizing XPath in resource file, how to pass arguement from robot file?

≯℡__Kan透↙ 提交于 2019-11-29 16:40:48
I am centralizing all particular XPath strings to a resource file and importing the variables in that resource file in my test suite (robot framework). This way, they can be maintained in one place and I can use variable names that make the robot file readable. Is that something that is good practice? Sometimes I want to pass an argument to the variable, to make it more dynamic. However, the value of the variable contains and XPath, which sometimes has //div[path...etc][text()='MyString']. Question: In the robot file, how to pass an argument ('MyString') to the Click Element method that is