我正在尝试(成功)连接到连接了我的设备的远程服务器。
但是,尽管我付出了很多努力和研究,但始终出现InsecureRequestWarning
条警告...
代码:
*** Settings ***
Library AppiumLibrary
*** Test Cases ***
First run wizard - Connect to Remote
[Setup] Install and open app
[Teardown] Close all applications
Log Hello World WARN
Sleep 10
*** Keywords ***
Install and open app
open application ${Grid} &{MyDevice} &{UserCredential} &{Android_app}
*** Variables ***
${Grid} http://xxx/appium
&{Huawei_P20_Pro} uuid=xxx relaxed-security=True
&{UserCredential} Username=xx ApiKey=xxxx
&{Android_app} appPackage=xxx appActivity=xxx appWaitActivity=xxx
输出:
First run wizard - Connect to Remote
C:\Users\xxx\AppData\Local\Programs\Python37-32\Lib\site-packages\urllib3\connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
[ WARN ] Hello World
C:\Users\xxx\AppData\Local\Programs\Python37-32\Lib\site-packages\urllib3\connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
| PASS |
------------------------------------------------------------------------------
InsecureRequestWarning)
test :: Android template to connect to Remote | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Output: C:\Projects\RF\test\output.xml
Log: C:\Projects\RF\test\log.html
Report: C:\Projects\RF\test\report.html
Process finished with exit code 0
我尝试将功能relaxed-security
放到无效的位置。
我发现Create Session
关键字和参数verify = True也有类似的情况,但是它在Open Application
上也不起作用。
当前,我将修改urllib3库的源代码以防止出现这种讨厌的警告,但这不是正确的解决方案。 因此,我想知道是否有人可以在这里找到线索!
(使用http或https在输出中没有区别)
[此处为部分回答Suppress InsecureRequestWarning: Unverified HTTPS request is being made in Python2.6: 这只是一种解决方法,它显示了如何禁用警告,而不是如何阻止警告(==使事情正确),例如启用证书验证。