我们将三个文本文件传递给 pybot,生成的输出采用分层格式。例如,在report.html 文件的Test Statistics 部分中,在Statistics by Suite 下,观察到Test 1 & Test 2 & Test 3.Test 1。通过编辑 /usr/local/lib/python2.7/dist-packages/robot/htmldata/rebot 下的 report.html 模板文件,将其更改为仅显示测试 1。
log.html 模板文件也进行了更改,以在 log.html 文件中获得上述所需的输出。但我没有找到,在哪里更改以获得所需的 output.xml 文件。output.xml 文件仍然具有类似 Test 1 & Test 2 & Test 3.Test 1 的格式。有人可以帮助解决这个问题吗?
我是机器人框架的新手。
我已经把chromedriver.exe文件放在系统路径中。现在,当我在 RIDE 中运行脚本时,出现此错误:
WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
在 RIDE 本身中还有其他设置路径的方法吗?
更新:我的路径变量包括:
C:\Driver\chromedriver.exe;
selenium webdriver robotframework selenium-chromedriver selenium2library
每次运行脚本时,我都想在机器人框架中创建一个唯一的字符串。
*** Settings***
Library Selenium2Library
Library String
*** Variables ***
${RANUSER} Generate Random String 10 [LETTERS]
*** Test Cases ***
Enter Random Username
Input Text //input[@id='userInput'] ${RANUSER}
Run Code Online (Sandbox Code Playgroud)
使用这个,我总是得到Generate Random String 10 [LETTERS]我的输出,但我一直想要独特的输出。谁能帮帮我吗。
泰
我不确定这里出了什么问题。我给了一个时间来转换时间的格式和结果格式,如下所示:
${date_to_search_for}= Convert Date 2017-06-14 13:03:02.506610 date_format=%Y-%m-%d 00:00:00.00000 result_format=%d %b %Y 00:00:00 exclude_millis=True
Log to console ${date_to_search_for}
Run Code Online (Sandbox Code Playgroud)
运行此代码,出现此错误:
ValueError: time data '2017-06-14 13:03:02.506610' does not match format '%Y-%m-%d 00:00:00.00000'
Run Code Online (Sandbox Code Playgroud)
我仔细检查了两种格式,看不出有什么不同!我不明白为什么它会抛出这个错误。
在 Robot Framework 中执行关键字“运行关键字并期望错误”时,我面临以下问题。
首先我试过这个:
run keyword and expect error InvalidElementStateException: Message: invalid element state: Element is not currently interactable and may not be manipulated Input Text ${indFNPatientHealth Link} RCIGM_FN
Run Code Online (Sandbox Code Playgroud)
它失败了。回溯是:
17:44:01.894 FAIL InvalidElementStateException: Message: invalid element state: Element is not currently interactable and may not be manipulated
(Session info: chrome=60.0.3112.101)
(Driver info: chromedriver=2.30.477700 (0057494ad8732195794a7b32078424f92a5fce41),platform=Windows NT 6.1.7601 SP1 x86_64)
17:44:01.894 FAIL Expected error 'InvalidElementStateException: Message: invalid element state: Element is not currently interactable and may not be manipulated' but got …Run Code Online (Sandbox Code Playgroud) 我试图从下面提到的字符串中获取数字 70:
显示 1 到 50 个条目,共 70 个条目
我试过下面的代码:
${text} = Get Text xpath=//div[@id='DataTables_Table']
Page Should Contain Showing 1 to
${edited_text} = Remove String ${text} Showing 1 to 50 of
Run Code Online (Sandbox Code Playgroud)
但我收到以下提到的错误:
未找到名称为“删除字符串”的关键字。
即使我使用以下关键字,我也会收到相同的错误:
获取子字符串,替换字符串
请告诉我如何将以下机器人(txt)代码转换为 Python 代码。机器人代码。
*** Settings ***
Library OperatingSystem
*** Keywords ***
nik_key_1
[Arguments] ${arg1_str}
log to console ${arg1_str}
*** Variables ***
${var1} "variable1"
*** Test Cases ***
First Test Case
${output}= run "hostname"
log to console ${output}
${str1}= catenate "nikhil" "gupta"
nik_key_1 "NikArg1"
log to console ${var1}
log to console ${str1}
Run Code Online (Sandbox Code Playgroud)
以下是我尝试的代码:
from robot.api import TestSuite
from robot.running.model import Keyword
from robot.libraries.BuiltIn import BuiltIn
from robot.api.deco import keyword
bi = BuiltIn()
@keyword(name='nik_key_1')
def nik_key_1(username):
bi.log_to_console(message=username,stream='STDOUT',no_newline=False)
suite = TestSuite('Activate Skynet')
suite.resource.imports.library("OperatingSystem") …Run Code Online (Sandbox Code Playgroud) 我在资源文件中定义了一些变量。
*** Variables ***
${x} SomeValue
# Derived String
${y} SomeString_${x}
Run Code Online (Sandbox Code Playgroud)
在现有测试用例中使用它后,我修改了${x}. 之后我可以${x}用作修改后的变量但${y}保持不变。我们是否有一些方法可以${y}根据 new重新启动${x}。
是否有任何关键字可以与 Robot Framework 中的“等待关键字成功”相同,或者我是否必须完全创建一个新关键字?我对该框架相当陌生,我希望实现以下目标:
Wait Until Keyword Succeeds 10x 20s
... ${response} = Some Keyword arg
... Should Match ${response} ${val}
Run Code Online (Sandbox Code Playgroud)
或者有另一种方法来解决这个问题吗?
我遇到了一个问题,我必须将字典(或其他一些数据存储数据类型)作为参数传递给某个方法,该方法将从该方法中动态获取所有用户并执行所需的操作。我的问题是:
1) 在机器人框架中可以吗?
2)如果可能的话,我们将如何做到这一点?
Adding Participant
... Number_of_users= depend on participants name
... Participant name= x, y, z, etc..
Adding Participant
[Arguments] ${Number_of_users} ${Participant name}
:FOR ${ELEMENT} IN ${Participant name} --> [How this participant name will be stored dynamically ?]
\ Log ${ELEMENT}
\ Run Keyword ${ELEMENT} {?{?{?{It will do some operations for user x then in next loop y and so on}}}
Run Code Online (Sandbox Code Playgroud) robotframework ×10
python ×3
selenium ×2
date-format ×1
python-2.7 ×1
robots.txt ×1
webdriver ×1
xml ×1