RobotFramework-----使用jquery操作元素


*** Settings ***
Library           Selenium2Library

*** Keywords ***

XXXX登錄
    [Documentation]    儲值賬號
    open browser    http://XXX.com/    chrome
    maximize browser window
    Execute Javascript    a = window.document.createElement('script');a.src='//code.jquery.com/jquery-1.9.1.min.js';window.document.body.appendChild(a);
    input text    //*[@id="userMobile"]    XXX
    input text    //*[@id="userPass"]    111111
    Comment    click element    xpath=/html/body/div[1]/div/div/input
    execute javascript    $("input[class='SignIn']").click()
    Comment    click element    dom=$("input[class='SignIn']")
    [Teardown]    sleep    10

 

1. 引用javascript

2. 使用jquery操作元素

3. 也可以使用jquery來定位元素,再使用selenium2library的click element來對其操作


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM