学习Httprunner 跑脚本过程中遇到的问题:
1.pip安装httprunner时遇到的证书问题:Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)'))) - skipping
解决方法参考:https://blog.csdn.net/qq_34504481/article/details/81910253
2.需要用到sudo命令,结果window没有这个命令:
解决方法:编写一个文件名为sudo.vbs ,然后把路径配置到环境变量Path中,例如C:\test\
文件内容:
'ShellExecute 方法
'作用: 用于运行一个程序或脚本。
'语法
' .ShellExecute "application", "parameters", "dir", "verb", window
' .ShellExecute 'some program.exe', '"some parameters with spaces"', , "runas", 1
'关键字
' application 要运行的程序或脚本名称
' parameters 运行程序或脚本所需的参数
' dir 工作路径,若未指定则使用当前路径
' verb 要执行的动作 (值可以是 runas/open/edit/print)
' runas 动作通常用于提升权限
' window 程序或脚本执行时的窗口样式 (normal=1, hide=0, 2=Min, 3=max, 4=restore, 5=current, 7=min/inactive, 10=default)
Set UAC = CreateObject("Shell.Application")
Set Shell = CreateObject("WScript.Shell")
If WScript.Arguments.count<1 Then
WScript.echo "Please use command : sudo <command> [args]"
ElseIf WScript.Arguments.count=1 Then
UAC.ShellExecute WScript.arguments(0), "", "", "runas", 1
' WScript.Sleep 1500
' Dim ret
' ret = Shell.Appactivate("用户账户控制")
' If ret = true Then
' Shell.sendkeys "%y"
' Else
' WScript.echo "自动获取管理员权限失败,请手动确认。"
' End If
Else
Dim ucCount
Dim args
args = NULL
For ucCount=1 To (WScript.Arguments.count-1) Step 1
args = args & " " & WScript.Arguments(ucCount)
Next
UAC.ShellExecute WScript.arguments(0), args, "", "runas", 5
End If
网友评论