robotframework

How to write python function to test the matched strings (to use for Robot framework keyword)?

人走茶凉 提交于 2019-12-04 18:34:09
I am writing a custom library for robot framework in python. I don't want to use builtin library for some reasons. My python code : import os import re output = "IP address is 1.1.1.1" def find_ip(): cmd = 'ipconfig' output = os.popen(cmd).read() match1 = re.findall('.* (1.1.1.1).*',output) mat1 = ['1.1.1.1'] if match1 == mat1: print "PASS" In the above program I have written python function to : Execute a windows command "ipconfig" Written regular expression to match 1.1.1.1 create a list variable, mat1 = ['1.1.1.1'] Now I want to put condition like, if "match1" and "mat1" are equal my TEST

How can we pass different browser at once in robotframework

大城市里の小女人 提交于 2019-12-04 18:15:15
问题 *** Variables *** ${BROWSER} firefox ${URL} http://url/ ${Delay} 0 in my settings.txt file i have a variable named {BROWSER} AND associate value as shown above it is firefox but what i want is *** Variables *** @{BROWSERS} firefox chrome IE ${URL} http://url/ ${Delay} 0 something like above... so when i run test-suite first it will run in firefox and after completion of all testcases it will close firefox and will open chrome and run all the test cases again on chrome browser ..and so on

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

会有一股神秘感。 提交于 2019-12-04 18:13:23
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) driver.get('http://google.com') driver.quit() But actual problem exists when I try to get the same working

How to use OR condition for Keywords in Robot Framework?

最后都变了- 提交于 2019-12-04 17:29:22
I am in need to check the condition that is going to be passed if one of the conditions being true. The Keywords like I want to use is as below: Page Should Contains Element //some xpath OR Page Should Contains Element //some xpath OR Page Should Contains Element //some xpath OR Page Should Contains Element //some xpath Used Run Keyword If but it is not working You can join XPath result sets with the | to do what is equivalent to an OR. ${count} Get Matching Xpath Count //div[@prop='value'|//table[@id='bar']|//p Run Keyword If ${count} > 0 Some Keyword If you just want to fail if none of the

How to do some infinite task with Robot Framework?

这一生的挚爱 提交于 2019-12-04 16:37:20
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. But I want to do this continuously (infinite). Any clue please? Thanks in advance for your help. You could put it inside a for loop. It is not infinite but if you put large enough value it is close enough for practical purposes. This will create a huge log file. testcase1

__init__.txt in Robot Framework

ε祈祈猫儿з 提交于 2019-12-04 16:10:58
I have the following structure: test_init |__________resources | |__________ keywords.robot |__________tests |__________ __init__.txt |__________ TestInit.robot The keywords.robot contains: *** Keywords *** Keyword for init Log init The __init__.txt contains: *** Settings *** Documentation This is from init file Resource ${EXECDIR}/resources/keywords.robot The TestInit.robot contains: *** Test Cases *** Testing the Init Log Vimal Keyword for init And from command line in the test_init directory, if I execute as follows: > pybot tests I get the error saying that: No keyword with name 'Keyword

Parse Robot Framework's output xml

南笙酒味 提交于 2019-12-04 14:51:27
Robot framework spits out an output XML which is then used to build the HTML reports (with rebot ), re-run failures, etc. I need to parse this file to generate other reports, in particular, I need to parse the test case's documentation for a regex, get the test case result and then build a report (this is for integration with a legacy system). Does Robot Framework provide functionality to easily parse the output XML file or we just use standard XML parsing libraries? Ok, found 3 viable responses: Use DbBot and query the DB created. Parse the XML file directly. Using xml.etree.ElementTree is

How to set preferences for FireFox in Robot Framework

这一生的挚爱 提交于 2019-12-04 14:33:23
问题 I'm trying to write a test case in robot framework to download an excel file automatically from a web-site. I want to set preferences for my browser using robot scripts to download files automatically in my desired destination directory without asking me! I have tried this solution; but it didn't work. I also tried to set an existing firefox profile as this says which works fine, but I want to be capable of automatically adjusting preferences. Any idea? As @Sachin said I wrote a python script

Robot framework pass cookie to get request (RequestsLibrary) - TypeError

时光怂恿深爱的人放手 提交于 2019-12-04 13:54:15
I need to pass cookie value to Get request keyword to make it work, but it is still failing. I am not sure how to pass it correctly there. Documentation of the keyword says about the headers: "headers: a dictionary of headers to use with the request" I have test like this, using Library RequestsLibrary : Check request and response Do Local Login ${username} ${password} #this is my custom keyword - opens browser and logs in using UI ${cookie_value}= Get Cookie Value JSESSIONID Create Session session1 https://oururl.com verify=${False} cookies=${cookie_value} ${dict}= Create Dictionary Cookie=$

How to reduce waiting time in Selenium2Library Robot Framework

爷,独闯天下 提交于 2019-12-04 13:40:56
I have a test script in Robot Framework which I want to reduce its elapsed time. I have below command as a part of the test procedure: wait until element is enabled id=${elementId} In run time, it takes about 5 seconds to be done; I've set selenium implicit wait to 2 seconds using below line at the beginning of the test: set selenium implicit wait 2 seconds I get the applied selenium implicit wait afterwards with get selenium implicit wait and it returns 2 seconds , but the first command still takes about 5 seconds to complete. What should I do to reduce this time?? Any help or suggestion will