汪晓康

导航

RobotFramework框架:Cookie登录和缓慢滚动下滑

cookie是手工登录账号后,通过get cookies获取的,然后再填入代码中。

浏览器滚动是使用for循环,调用execute javascript方法并增加sleep实现的。

ride edit中的代码

浏览器滚动下滑
    open browser    https://tieba.baidu.com/    chrome
    maximize browser window
    add cookie    BDUSS    RzOVVQY09oaXAyeGFETTJIS3lXU2lUWk9iYTBtRUxjSmRIYmswZ2aDFsNFplRVFBQUFBJCQAAAAAAAAAAAEAAABEE-sk1Nm4x9K7wqUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHUKX151Cl9eVz
    add cookie    STOKEN    3c6363cb0bede0cfd3ab8126b256cd0b7700ad471e491ce0cc56a40f147f6995
    goto    https://tieba.baidu.com/
    FOR    ${i}    IN RANGE    1000
    \    ${t}    setvariable    ${i}*5
    \    evaluate    str(${t})
    \    ${tt}    Catenate    SEPARATOR=    document.documentElement.scrollTop=    ${t}
    \    execute javascript    ${tt}
    \    sleep    0.01

posted on 2021-08-09 23:23  汪晓康  阅读(288)  评论(0编辑  收藏  举报