robotframework

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

本小妞迷上赌 提交于 2020-01-01 19:22:27
问题 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

setup pythonpath before starting test suite

旧巷老猫 提交于 2020-01-01 19:13:49
问题 Currently I am setting pythonpath as pybot --pythonpath ~/Test_suite main.robot while running the tests. I also see there is option Set Environment Variable PYTHONPATH ${CURDIR} to set through robot framework. But it doesn't run before main settings *** Settings *** Documentation Suite description Resource settings.robot And below is settings.robot file *** Settings *** Resource keywords/keywords_test.robot Library tests.test_1.TestClass How to setup the pythonpath before running the suite?

How to reduce waiting time in Selenium2Library Robot Framework

谁说胖子不能爱 提交于 2020-01-01 16:49:09
问题 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

Looping through the content of a file in RobotFramework

时间秒杀一切 提交于 2020-01-01 05:50:09
问题 How can I loop through the contents of a file within Robot Framework? My file contents would be like this: 1001 1002 1003 1004 I want to read the contents one by one, assign it to a variable and then do some operations with it. 回答1: Robotframework has several built-in libraries that add a lot of functionality. Two that you can use for this task are the OperatingSystem library and the String library. You can use the keyword Get File from the OperatingSystem library to read the file, and you

How to disable loading external urls on seleniumlibrary/robotframework

本秂侑毒 提交于 2020-01-01 03:27:05
问题 I started playing with Seleniumlibrary tests (run with robotframework) and as our websites have ads and metrics and so on, every time I run a test those URLs get loaded. Is there a way to tell selenium/robotframework to not load certain types of URLs or prevent it to load external resources (i.e. everything that is not from localhost). 回答1: You can do that with browsermob-proxy. Once you have that installed, you simply setup the proxy and set the blacklist. ProxyServer server = new

How to get the css style of text-overflow in robot framework

♀尐吖头ヾ 提交于 2019-12-29 09:26:10
问题 How to get the css style of text-overflow in robot framework. For validating the ellipsis text. <td _ngcontent-c5="" class="fontStyle" data-placement="top" title="123456789123456789qwertyuiasdfghjklzxcvbnmasdfghjkqwertyuiasdfghjkzxcvbnmertyui"> 123456789123456789qwertyuiasdfghjklzxcvbnmasdfghjkqwertyuiasdfghjkzxcvbnmertyui </td> 回答1: Getting a value of a CSS property is not supported in the SeleniumLibrary for Robot Framework. However, there is a method called value_of_css_property in the

How to use variable, which value should be set in keyword or test, in XPATH?

泪湿孤枕 提交于 2019-12-29 07:06:10
问题 I need to click on element based on what value it contains..but I want to set this value in test run or keyword definition (best option is in the test I guess) How should I do it? the variable containing xpath should look like that: ${DROPDOWN ITEMS} xpath=//*[contains(@class,'listitem-element')]/span[contains(text(),'${second_number}')] This locator works when I replace the variable with actual number like '002', but I want to have it more general.. In keyword definition I use it like:

RobotFramework, how to check text on page

吃可爱长大的小学妹 提交于 2019-12-29 01:45:28
问题 if there appears text on a page after hitting a button. the only thing it is in is a class, like so: <label class="err">2 van de 3 velden Eiwit, Koolhydraten, Vet zijn leeg.</label> with what should you verify? I tried: Page Should Contain Textfield err but that's not the way to go I think *** Keywords *** Open Browser To Login Page Open Browser ${LOGIN URL} ${BROWSER} Maximize Browser Window Set Browser Implicit Wait 5 Set Selenium Speed ${DELAY} Login Page Should Be Open Login Page Should

How can I start a Robot Framework test in a Jenkinsfile using a robot framework docker image? [closed]

£可爱£侵袭症+ 提交于 2019-12-25 19:09:11
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . In the Jenkinsfile I would like to use an existing Robot framework docker image. The Docker image that is pretty complete for browser testing is: ppodgorsek/robot-framework An example of the use is: docker run \ -v <local path to the reports' folder>:/opt/robotframework/reports:Z \

File Upload Option in Automation Testing Using Robot Framework

断了今生、忘了曾经 提交于 2019-12-25 18:16:25
问题 I need to test a particular scenario where I need to upload a file from any folder from my local machine and check whether it gets uploaded correctly as that of below image. I am writing automation testing script using Robot Framework to test in Chrome browser I am trying to use Choose File Keyword which is normally used for this scenario. Test8 To upload a file from Local Drive Open Browser http://localhost:35234/ chrome Select From List By Index ${transmission drop down} 0 Choose File $