Robotframework / Selenium2Library:为什么Drag and Drop不能与draggable元素一起使用?

时间:2015-03-04 13:05:19

标签: javascript selenium selenium-webdriver webdriver robotframework

如果安装了python(v2.7),robotframework(v2.8.7)和Selenium2Library(v1.6.0),则可以运行以下测试用例以了解问题,例如:使用:pybot -L TRACE

*** Settings ***
Library           Selenium2Library

*** Variables ***

*** Test Cases ***
DragDemo
    Open Browser    http://www.w3schools.com/html/html5_draganddrop.asp    firefox    
    # NO VISIBLE ACTION HERE, BUT COMMANDS TAKE SOME MINUTES TO EXECUTE WITHOUT FAILURE
    Wait Until Page Contains Element    //img[@id='drag1']
    Drag And Drop   //img[@id='drag1']  //div[@id='div2']
    Drag And Drop By Offset     //img[@id='drag1']  50  0
    Drag And Drop By Offset     //img[@draggable='true']    100     0
    Drag And Drop By Offset     //img[@alt='W3Schools']    10     -10
    Mouse Down  //img[@id='drag1']
    Mouse Over  //div[@id='div2']
    Mouse Up    //div[@id='div2']
    # DRAG AND DROP ACTION HERE
    Drag And Drop By Offset     //span[contains(text(),'Drag and Drop')]    500     -500
    Sleep   5

*** Keywords ***    

测试导航到公共网站并尝试以各种方式拖放可拖动元素。如内联注释中所述,命令执行时没有失败但没有可见效果。但是,最后一个拖放命令是在一个不可拖动的元素上执行的,奇怪的是,有一些动作(标记了文本)。测试日志显示在任何一种情况下都执行POST。为什么其他DnD命令不能按预期工作?

0 个答案:

没有答案