Ignore or resolve certificate warnings for test automation in robot framework

瘦欲@ 提交于 2021-01-05 13:05:51

问题


While browsing URL using the robot automation framework, I am always getting a message "Your connection is not private". Then we need to click on Advanced and Proceed to URL. Manually proceeding to URL is not possible. So is there any solution to skip such certificate checking for test automation in the robot framework. I had read the answer for the question: How to resolve ssl certificate errors for test automation in robot framework . I tried following but it didn't work.

Open Browser    ${loginUrl}    browser=${browser}    options=add_argument("--ignore-certificate-errors")

The error says:

- Positional argument cannot be used after named arguments. Although this argument looks like named one, it isn't because there is no 'options' argument in the keyword definition

Please help.


回答1:


You can try with creating web driver and set parameters separately as shown below.

*** Test Cases ***
TestProcess
    ${chrome_options}    Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys, selenium.webdriver
    Call Method    ${chrome_options}    add_argument    --ignore-certificate-errors    
    Create Webdriver    Chrome    chrome    chrome_options=${chrome_options}    
    Go To    https://expired.badssl.com/


来源:https://stackoverflow.com/questions/60490989/ignore-or-resolve-certificate-warnings-for-test-automation-in-robot-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!