robotframework

Saving class objects in robot framework

橙三吉。 提交于 2019-12-06 15:59:25
问题 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 there a way to do that? Aristalibrary.py import pyeapi active_conn = None class AristaLibrary: def __init__(self, proto="https", hostname='localhost', username="admin", passwd="admin", port="443"): self.hostname = hostname self.proto = proto self.port =

Robot Framework data-driven automation testing: Can data derived from a database be used as a data source for a test template?

不打扰是莪最后的温柔 提交于 2019-12-06 15:59:07
问题 I am familiar with using template keywords in data-driven Robot Framework testing and know that external sources of data such as text files and csv files can be used to provide test data. However, the organisation I work for wants to use data held in a database as a source for test case data. Does anybody know if this is possible? I have searched Stack Exchange, Stack Overflow and other resources but cannot find an answer or any examples. Here is an example of the data-driven approach I am

How to handle dynamic elements using Robot Framework

有些话、适合烂在心里 提交于 2019-12-06 15:53:49
问题 I am currently working on the Robot Framework and using Selenium2Libraries to work on a Web Application. I'm working on a Form and I'm dealing with a dynamic elements which is an editable text area and drop down list.. I really hope someone would be able to guide me on how I can do this. An example of what I am doing is, [Example element code] input id="textfield-1237-inputEl" class="x-form-field x-form-text x-form-text-default x-form-focus x-field-form-focus x-field-default-form-focus" data

Register Robot Framework listener within Python library

戏子无情 提交于 2019-12-06 15:10:29
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 line, so that those listeners are always used when my library is imported (I want the keywords and listeners to work together). Is there a way to register a listener using Python code? Starting with robot framework 2.8.5, you can register a library as a

Multiple devices connected error in Robotframework

此生再无相见时 提交于 2019-12-06 14:48:49
问题 I am using Robot Framework with UI-Automator for automating Native Android application. In my current instance I have connected two devices to my PC- one for my general testing work and in the second device, I am running Automation. I have given serial of the device while running the test cases. But I am getting following error in the console: EnvironmentError: Multiple devices attached but default android serial not set can somebody help me what I need to do. 回答1: The answer is on the

How can we set a variable such that it can be used in a different test suite?

两盒软妹~` 提交于 2019-12-06 14:46:23
I need to set an variable in testSuite#1. Use the above variable in testSuite#2. Do we have any keywords to do it? Can we export it at command line? Use BuiltIn's Set Global Variable . This should be avoided whenever possible, but is sometimes necessary. Set Global Variable ${MYPROJ_ADMIN_PASSWORD} supersecret123 This is not a very good idea, because you end up with a dependency between two suites, and a dependency on the order that the suites are run. That being said, there are a couple of ways you can accomplish this. Using Set Global Variable The first method is to use the Set Global

Opening Chrome browser in Android device using Robot Framework script and chromedriver?

半腔热情 提交于 2019-12-06 14:16:13
问题 Automation setup on Ubuntu 14.04: Robot Framework 2.9.2 (Python 2.7.6 on linux2) selenium2library-1.7.4 ChromeDriver 2.20.353124 Device under testing: Nexus 7 (KitKat 4.4, Chrome v. 47) Everything works fine when running this following example test with Python --> URL is launched properly on Chrome in Nexus device. from selenium import webdriver capabilities = { 'chromeOptions': { 'androidPackage': 'com.android.chrome', } } driver = webdriver.Remote('http://localhost:9515', capabilities)

IE browser nor working with robot framework

瘦欲@ 提交于 2019-12-06 13:15:17
I have an issue with robot framework running on IE 8 64 bit browser. I am trying to run the tests on IE, the scripts are failing because it gives an error. Please find the error in a report. Is this because of security settings in IE? And if I make it common security level zones then the browser behaviour is different. As like it minimises and maximises the browser and fails the particular test. Here is the link for the screenshot. And as I know it also depends on the xpaths/ css / javascript properties. It runs fine with other two browsers chrome/firefox. So please suggest to me, what the

How to set multi-level test setup/teardown in robot framework

强颜欢笑 提交于 2019-12-06 12:48:10
I have some robot test cases separated in directories. The directory hierarchy is: ParentTestDirectory |__ ChidTestDirectoryOne |__ TestOne.robot |__ ChidTestDirectoryTwo |__ TestTwo.robot |__ __init__.robot Content of __init__.robot : *** Settings *** Test Setup LOG TO CONSOLE Test setup from __init__.robot Test Teardown LOG TO CONSOLE Test teardown from __init__.robot Content of TestOne.robot : *** Settings *** Test Setup LOG TO CONSOLE Test setup from TestOne.robot Test Teardown LOG TO CONSOLE Test teardown from TestOne.robot *** Test Cases *** Test One LOG TO CONSOLE This is Test One!

RobotFramework - get current Date

旧巷老猫 提交于 2019-12-06 12:47:13
I need to test that the current date is displayed on my device, The date on the device is in format Monday, September 9, 2018 but when i try to test it i can only use the format Monday, 09, 2018 which would fail the test as there is no 0 in the Month date. page should contain element ${DATE} ${DATE_MESSAGE} get current date result_format=%A, %d, %Y element should contain text ${DATE} ${DATE_MESSAGE} How can change the format in robotframework to verify THis format Monday, September 9, 2018. ERROR should have contained text 'Monday, 09, 2018' but its text was 'Monday, September 9, 2018'.