robotframework

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

心已入冬 提交于 2019-12-06 07:53:35
问题 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

Robot Framework - passing Appium driver to python script

百般思念 提交于 2019-12-06 07:26:41
问题 I'm working on integrating Robot Framework with Appium, using Python. However I can't figure out how to pass the Appium driver created in the Robot Framework to a custom python script. My Environment: Mac OS - Mavericks Appium 1.2 (installed via home brew) Latest Robot Framework (installed via pip) Latest Appium Library for Robot Framework (installed via pip) I have a working Appium script in Python, but I want to start using Robot Framework for handling the actual tests. partial code for

Parse Robot Framework's output xml

天涯浪子 提交于 2019-12-06 07:21:56
问题 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? 回答1: Ok, found 3 viable

Robot framework: run setup for an entire test suite

我们两清 提交于 2019-12-06 06:18:53
Is it possible in ROBOT to run a setup for an entire test suite, rather than running the setup individually for each file? I want to run setup at the beginning of the suite, and if the setup fails, not run any of the test cases at all. For example, given the following file: *** Settings *** Test Setup Setup Fails *** Test Cases *** Case1 Should Be True 1<2 Case2 Should Be True 2<1 *** Keywords *** Setup Fails Should Be True 2<1 I want neither Case1 nor Case2 to execute at all. As it is, both attempt to use Setup Fails as setup individually, and the output.xml file has a status for each test

How to record test cases with robotframework?

我怕爱的太早我们不能终老 提交于 2019-12-06 06:11:56
I recently started using robotframework with the Selenium2Library . I haven't tested using Selenium before, but I know it is possible to record tests using Selenium . In RobotFramework , it says, "it is not possible" . I mean even for a simple login test, I need to write the test , specifying the id of username, password and submit button. However, is there any way by which these tests can be recorded using robotframework ? such as clicking on a text box, entering a string and then clicking on submit button etc., and automatically generate the test case source code instead of having me to

Calculate date 5 days from today, adding an extra day for each day in the next 5 days that is a weekend day

杀马特。学长 韩版系。学妹 提交于 2019-12-06 05:54:21
I am testing using Robot Framework and need to create my own Python keyword. Taking the current date as day 0 (tomorrow as day 1), I am trying to calculate what the date will be 5 days from today. If any of the days in the next 5 days is a Saturday I need to add an extra day to my calculation. Same if any of the days is a Sunday. As a Python beginner, I'm a little out of my depth so any help would be much appreciated Basically you need to add 5 business days... This should do it: import datetime def addBusinessDays(from_date, add_days): business_days_to_add = add_days current_date = from_date

Robot Framework verify a new browser tab was opened

十年热恋 提交于 2019-12-06 05:51:07
问题 For some of the web links on our page, there are external links which direct the user to say Facebook and Twitter. The links use the HMTL tag target="_blank" so that a new browser tab is opened for our Twitter page. I would like to verify 1. the new browser tab is open, 2. set focus to it and 3. validate page elements in the new browser tab. The #3 part would be easy enough, once I get focus on it. Tasks #1 and #2 though, I can't figure out, nor can I find anyone talking about this. Using

Get Type in Robot Framework

拜拜、爱过 提交于 2019-12-06 05:22:20
Could you tell me about how to get the variable type in Robot Framework. ${ABC} Set Variable Test ${XYZ} Set Variable 1233 Remark: Get the variable Type such as string, int get ${ABC} type = string get ${XYZ} type = int This is what I use: ${type} = Evaluate type($temp).__name__ Note: it's good to have global string/int/float/list/dict/... examples for comparison than hard-coding the type values as they might differ depending on build. You can do e.g. this: ${type_ABC} Evaluate type($ABC) 来源: https://stackoverflow.com/questions/42617970/get-type-in-robot-framework

Modifying lists of lists in Robot Framework

六月ゝ 毕业季﹏ 提交于 2019-12-06 03:49:57
问题 I have a nested list that I am using in Robot Framework. I would like to change one item in a sublist at the Robot Framework level. My list looks like this: [ bob, mary, [june, july, august]] I want to change "july" to something else, say "september" Robot Framework will let me change 'bob' or 'mary', but if I try to insert a list, it is converted into strings. (Oh, I have tried to use the "Insert Into List keyword to insert a new sub list, and other List keywords, no luck with any.) 回答1: I

How to open a new tab in same browser using robot frame work

家住魔仙堡 提交于 2019-12-06 02:45:28
As far as I know there is no straight keyword to open new tab in selenium2library. I have seen the below code which opens a new tab in IE(default browser)for the given URL webbrowser.open_new_tab(url) But I want to write a keyword which opens a new tab on current running browser (it may be any browser). That1Guy It's sloppy, but you can try: from selenium.webdriver.common.keys import Keys actions.key_down(Keys.CONTROL) element.send_keys('t') actions.key_up(Keys.CONTROL) I'm not aware of a browser-agnostic method. After opening a new tab you can change tabs by finding the window handle with