Robot Framework - 无法使用Execute JavaScript为Attribute设置Object

时间:2016-03-14 09:40:12

标签: javascript selenium-webdriver robotframework

我想使用Execute Javascript为value属性设置Object但它不适用于机器人框架(它与C#一起使用)  关键字:

InputTeasersForPageType
    [Arguments]    ${id}
    ${result}=    Set Json Value    {"PageId":"${id}"}    /PageId    "${id}"
    ${json_string}=    Stringify Json    [${result}]
    Unselect Frame
    Select Frame    id=ctl00_ctl00_FullRegion_EditPanelDiv
    Log    ${json_string}
    Execute Javascript    window.document.getElementById('ctl00_FullRegion_PC_109_1_EditForm_ctl18_hidValues').getAttribute('value');
    Execute Javascript    window.document.getElementById('ctl00_FullRegion_PC_109_1_EditForm_ctl18_hidValues').setAttribute('value',${json_string});

1 个答案:

答案 0 :(得分:0)

你试过这个我认为它应该有用吗? 执行Javascript window.document.getElementById('ctl00_FullRegion_PC_109_1_EditForm_ctl18_hidValues').value='${json_string}'