我正在尝试使用我的机器人框架测试套件运行chrome headless.我设法用pylen使用selenium独立完成,如下所示:
options = webdriver.ChromeOptions()
options.add_argument('--headless')
my_driver = webdriver.Remote(command_executer=my_remote_address, desired_capabilities=options.to_capabilities)
Run Code Online (Sandbox Code Playgroud)
以下代码是我在机器人中所做的但是没有用的代码:
${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
${options.add_argument}= Set Variable add_argument=--headless
Create WebDriver Chrome chrome_options=${options}
Open Browser http://www.google.com chrome
Run Code Online (Sandbox Code Playgroud) 我正在尝试设置将运行机器人测试的gradle任务。Robot使用python库与Selenium进行交互,以便通过浏览器测试网页。但是不幸的是,似乎安装https://github.com/robotframework/Selenium2Library的唯一方法是通过pip- pip install robotframework-selenium2library。有没有办法让Gradle在我的任务中运行此命令?
这是我所拥有的:
build.gradle:
configurations {
//...
acceptanceTestRuntime {extendsFrom testCompile, runtime}
}
dependencies {
//...
acceptanceTestRuntime group: 'org.robotframework', name: 'robotframework', version: '2.8.7'
//The following doesn't work, apparently this library isn't on maven...
//acceptanceTestRuntime group: 'org.robotframework', name: 'Selenium2Library', version: '1.+'
}
sourceSets {
//...
acceptanceTest {
runtimeClasspath = sourceSets.test.output + configurations.acceptanceTestRuntime
}
}
task acceptanceTest(type: JavaExec) {
classpath = sourceSets.acceptanceTest.runtimeClasspath
main = 'org.robotframework.RobotFramework'
args '--variable', 'BROWSER:gc'
args '--outputdir', 'target'
args 'src/testAcceptance'
}
Run Code Online (Sandbox Code Playgroud)
我的机器人资源文件-login.resource.robot:
*** Settings *** …Run Code Online (Sandbox Code Playgroud) 我想问一下机器人中是否有一个选项(使用selenium2library)来设置一些隐含的等待所有元素,这些元素应该在测试期间只在一个地方找到?目前我将EACH元素中的等待放在我的关键字中(看起来不太好)
Wait Until Element Is Visible ${repeated for each element}
Run Code Online (Sandbox Code Playgroud)
前端是在Angular中制作的.我发现它可能是麻烦的原因,我也发现了一些扩展的selenium2library,但是我不能使用这个扩展库,因为我只能使用官方支持的库(现在只是selenium2library)...
我还尝试在导入库时设置implcit等待和超时,但它似乎没有帮助(如果我在每个元素之前评论我的"等待",它会再次开始失败)
Library Selenium2Library 10 15
Run Code Online (Sandbox Code Playgroud)
有什么建议吗?在这种情况下,我真的必须在每个元素之前等待吗?
谢谢
automated-tests wait robotframework angularjs selenium2library
我正在测试web应用程序(使用RobotFramework和Selenium2Library),其中需要在几个点进行一些拖放操作.我尝试了拖放关键字,但它无法正常工作.
由于我无法通过生产应用程序,因此我使用以下页面重新创建了问题:https: //html5demos.com/drag/
我的代码是:
*** Settings ***
Library Selenium2Library
*** Variables ***
${URL} = https://html5demos.com/drag/
*** Test Cases ***
Prepare Browser
Open_Browser ${url} browser=chrome
Maximize Browser Window
Make Test
#Drag And Drop //*[@id="one"] //*[@id="bin"]
#Drag And Drop //*[@id="two"] //*[@id="bin"]
Capture Page Screenshot
Sleep 1
Close All
Close Browser
Run Code Online (Sandbox Code Playgroud)
尝试使用Python 2.7和3.6.
我得到的输出是测试显示为PASS,但我看不到拖放动作的任何实际结果(在我的生产应用程序和上面链接的示例页面中). 拖放测试结果的屏幕截图
当我在测试期间查看浏览器中发生的事情时,我注意到该对象变得可拖动(引用"拖我"在括号中添加)但测试代表了一个日志时间.移动鼠标光标时,测试继续上面提到的int PASS,但没有实际效果.
试用最新的Chrome,Firefox,IE.还尝试使用关键字鼠标按下,鼠标悬停,鼠标向上,但具有相同的结果.
以下是执行报告中的日志截图: 执行报告截图
我将不胜感激任何帮助或解决方法,以正确完成它.
我试图在 Robotframework 中自动化的一个条件:
RobotFramework 中的测试用例:
打开浏览器:
*** Settings ***
Library Selenium2Library
*** Variables ***
*** Keywords ***
Begin Web Test
open browser ${URL} ${BROWSER}
End Web Test
close all browsersRun Code Online (Sandbox Code Playgroud)
登录并创建IO:
*** Settings ***
Library Selenium2Library
Library AutoItLibrary
*** Variables ***
*** Keywords ***
Login and createIO
sleep 3s
WaitForActiveWindow WindowTitle=Authentication Required
Send ${Subscriptionsusername}
Send {TAB}
Send ${Subscriptionspassword}
Send {ENTER}
Capture Page Screenshot
Click Link xpath=//*[@class='tss-main-nav']/nav/ul/li[3]Run Code Online (Sandbox Code Playgroud)
我遇到的问题:
#Select Window URL=${URL} …Run Code Online (Sandbox Code Playgroud)我知道它们都可以用来验证一个元素是否出现在页面上,但我想知道每个元素的性能影响和可读性影响。所以我的问题是,假设您有 20 个元素要检查页面,
或者
selenium robotframework selenium-webdriver selenium2library webdriverwait
使用Robot框架和Selenium2Library处理iframe时遇到问题.它抛出错误:
WebDriverException: Message: unknown error: unhandled inspector error: {"code":-
32000,"message":"Cannot find context with specified id"}
(Session info: chrome=55.0.2883.87)
(Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 6.1.7601 SP1 x86_64)
Run Code Online (Sandbox Code Playgroud)
我的测试代码是:
Fill In Description ${description}
Wait Until Element Is Visible ${FRAME} 40
Select Frame ${FRAME}
wait until page contains element ${IFRAME BODY}
Click Element ${IFRAME BODY}
wait until page contains element ${IFRAME BODY}
Clear Element Text ${IFRAME BODY}
wait until page contains element ${IFRAME BODY}
Input Text ${IFRAME BODY} ${description}
Unselect Frame
Run Code Online (Sandbox Code Playgroud)
它失败了 Input …
selenium automated-tests robotframework selenium-webdriver selenium2library
我目前在机器人框架中使用Selenium2Library来自动化一些Web测试。目前,我在使用Click Element功能自动单击登录按钮时遇到问题。
这是我想使用的元素:
<a class="transparentBtn loginLink ng-scope" ng-click="commonService.gigyaRaasLogin()" translate="BTN_ADMIN_LOGIN_WATCHLIST">LOGIN</a>
如果我从控制台复制,则为xpath:
//*[@id="menu"]/div/div[5]/div/div/div[2]/ul/li[2]/a
如果要单击此元素,我很难找到要使用的定位器。
这些是到目前为止我尝试过的一些事情:
Click Element css=a.loginLinkClick Element link=LOGIN在 selenium 中,我通过命令使用了 webdriver 管理器:
driver = webdriver.Chrome(Chromedrivermanager().install())
Run Code Online (Sandbox Code Playgroud)
是否有用于机器人框架的网络驱动程序管理器?我希望 webdriver 管理器在运行测试脚本时自动下载,而不会产生额外的干扰。
有人可以帮助我如何使用selenium2library和Robot Framework从Windows目录上传文件.我尝试在selenium2library中使用选择文件命令,但我收到错误,因为本地文件系统中不存在文件.我不确定目录路径是否是未考虑或任何其他问题.请给我有效的代码或任何替代解决方案.任何帮助将不胜感激.以下是我试过的命令
Choose file xpath = //input[@firmware-upgrade='firmware'] /Downloads/Cambium_Builds/Falcon/ePMP1000-Hotspot-2.5.1-b3.tar
Run Code Online (Sandbox Code Playgroud)
HTML标签是`
robotframework ×10
selenium2library ×10
selenium ×5
angularjs ×1
autoit ×1
drag ×1
gradle ×1
python ×1
wait ×1