0

I'm trying (successfuly) to connect to a remote server where my device is connected. But, despite my effort and researchs, I always have InsecureRequestWarning warning showing up...

The code :

*** 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

The output :

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

I've tried to put the capability relaxed-security it didn't work. I've found some similar case with Create Session Keyword and the parameter verify=True, but it doesn't work on Open Application either.

Currently, I'm about to modify the source code of the urllib3 library to prevent this anoying warning, but this is not a proper solution. Thus I was wondering if someone could have a clue arround here !

(using http or https makes no difference in the output)

[Partial answere here Suppress InsecureRequestWarning: Unverified HTTPS request is being made in Python2.6 : It's just a workaround, it shows how to disable the warning, not how to prevent it (== make the things right) such as enable the certificate verification]

Sokrah
  • 105
  • 1
  • 1
  • 11
  • Possible duplicate of [Suppress InsecureRequestWarning: Unverified HTTPS request is being made in Python2.6](https://stackoverflow.com/questions/27981545/suppress-insecurerequestwarning-unverified-https-request-is-being-made-in-pytho) – cullzie Mar 25 '19 at 00:02
  • Yeah well, it's just a workaround. Adding the lines `import urllib3 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)` Into a custom library does the trick, but it doesn't really solve the problem. It just disable the warning. I guess I could be content with it, but I'm really wondering if there is a proper way to not trigger the warning. – Sokrah Mar 25 '19 at 13:00

0 Answers0