【问题标题】:How to accept cookies with robot framework?如何接受带有机器人框架的 cookie?
【发布时间】:2022-01-24 10:47:05
【问题描述】:

如何处理cookie窗口并使用机器人框架接受它?我试着在这个网站上做:https://www.ibm.com/br-pt

和我的代码(接受 cookie):

Page should contain element  class=truste_box_overlay_border
sleep  5s
Click element  class="call"

【问题讨论】:

  • 请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: python html css robotframework


【解决方案1】:

尝试使用以下关键字定义

*** Keywords ***
Accept Cookies
     Wait Until Page Contains Element   ${ACCEPT_COOKIES_BUTTON}
     Click Element   ${ACCEPT_COOKIES_BUTTON}
     ${cookie_banner_closed}     Run Keyword And Return Status   Wait Until Page /*continued*/
     Does Not Contain Element   ${ACCEPT_COOKIES_BUTTON}     2s
     Run Keyword If      ${cookie_banner_closed}==False 
     Click Element   ${ACCEPT_COOKIES_BUTTON}

【讨论】:

    猜你喜欢
    • 2021-07-30
    • 2014-12-18
    • 2016-02-02
    • 1970-01-01
    • 2020-07-10
    • 2015-09-28
    • 2023-03-18
    • 2019-02-18
    • 2018-05-01
    相关资源
    最近更新 更多