首页 文章

机器人框架:什么会导致0字节屏幕捕获?

提问于
浏览
1

我已经成功地使用Robot Framework进行测试自动化了一段时间,而Selenium 2自动屏幕捕获一直都很完美 .

就在本周修复脚本时,我注意到Selenium2Library自动屏幕捕获都是 0 bytes .

在幕后...... S2L只是将“Capture Page Screenshot”关键字设置为失败时运行的关键字 . 当我在脚本中明确调用“Capture Page Screenshot”关键字时,会按预期捕获屏幕截图 .

但是,如果我的某个S2L步骤失败,并且自动捕获屏幕截图,则该屏幕截图为0字节 .

知道为什么会这样吗?

1 回答

  • 0

    好吧,你没有提供有关Selenium2Library和Selenium版本,操作系统和哪个浏览器的更多信息 . 请尝试以下示例(在我的Fedora 22中运行正常,x64与Selenium2Library 1.7.4,Selenium 2.53.6,Firefox ESR 45.1.0,Google Chrome 52.0.2743.116和PhantomJS 2.1.1):

    *** Settings ***
    Library           Selenium2Library    15    2
    
    *** Test Cases ***
    Screen Capture Test
        [Documentation]    Using http://example.org/
        Open Browser    http://example.org/    ${BROWSER}
        Wait Until Page Contains    More information
        Click Link    More information...
        Wait Until Page Contains    I Love Robot Framework!
        [Teardown]    Close All Browsers
    

相关问题