简体   繁体   English

您可以使用Robot Framework进行跨浏览器测试吗

[英]Can you have cross browser testing using Robot Framework

I have a robot-framework test suite that runs all OK. 我有一个运行正常的机器人框架测试套件。

I have it running with pabot and selenium Grid, so parallel testing is all good. 我让它与pabot和Selenium Grid一起运行,因此并行测试都很好。

My question is, can I run my test suite against multiple browsers without having to manually run the same scripts for each browser or duplicating my test suite for each browser. 我的问题是,我可以针对多个浏览器运行测试套件,而不必为每个浏览器手动运行相同的脚本,也不必为每个浏览器复制测试套件。 Essentially, using a "Resource.txt" file to tell the test to instantiate the browser the grid node is set up for. 本质上,使用“ Resource.txt”文件告诉测试实例化设置网格节点的浏览器。

For example, in a TestNG project (Using POM method) I use the "if" and "else" methods to tell the test to use the browser that the selenium grid node is set up for. 例如,在一个TestNG项目中(使用POM方法),我使用“ if”和“ else”方法来告诉测试使用浏览器设置了硒网格节点。

Python 2.7 RF 3.0.2 Grid 3.5 Python 2.7 RF 3.0.2网格3.5

The common way to do this is to use a variable to hold the name of the browser, and then set the variable from the command line 常用的方法是使用变量保存浏览器的名称,然后从命令行设置变量

In your test case: 在您的测试用例中:

open browser  ${ROOT_URL}  ${BROWSER}

From the command line: 在命令行中:

robot --variable BROWSER:firefox ...
-or-
robot --variable BROWSER:chrome ...

An alternative to setting the variable on the command line is to have your tests use a variable file which dynamically sets the value of the variable based on runtime conditions. 在命令行上设置变量的一种替代方法是让您的测试使用变量文件 ,该文件根据运行时条件动态设置变量的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Google Chrome浏览器中使用Robot框架 - Using Robot framework with Google Chrome browser 使用机器人框架测试使用OAuth 2.0的REST API - Testing REST APIs which use OAuth 2.0 using robot framework chrome 浏览器没有用机器人框架打开 - chrome browser is not opening with robot framework 如何使用机器人测试框架从创建的会话中获取访问令牌 - how to get access token from created session using robot testing framework 使用Robot Framework的Open Browser方法禁用Chrome扩展 - Disable Chrome extensions with Robot Framework's Open Browser method robot framework - 使用selenium grid启动远程浏览器时出错 - robot framework - Error when launching remote browser with selenium grid 如何使用机器人框架接受警报 - How to accept an alert using robot framework 错误:无节:使用DatabaseLibrary的Robot Framework中的“默认” - Error: No section: 'default' in Robot Framework using DatabaseLibrary 我们如何使用 Robot Framework 在 Chrome Icognito 模式下打开 URL - How can we open a URL in Chrome Icognito mode using Robot Framework 使用自定义库运行机器人框架测试用例时,如何解决“NameError: global name 'x' is not defined”错误? - How can I resolve “NameError: global name 'x' is not defined” error while running a Robot Framework testcase using a custom library?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM