代码:
#coding=utf-8
import requests
import json
url='http://127.0.0.1:4444/wd/hub/session’
data = json.dumps({
‘Capabilities’:{
‘browserName’:‘Edge’
}
})
print(requests.post(url,data).json())
异常日志:
PS E:\30.Study\30.自动化测试\99.零基础入门 Python Web 自动化测试\10.seleniumCodePractice> & “C:/Program Files/Python38/python.exe” “e:/30.Study/30.自动化测试/99.零基
础入门 Python Web 自动化测试/10.seleniumCodePractice/202006/requests_open_browser.py”
{‘value’: {‘stacktrace’: ‘org.openqa.selenium.SessionNotCreatedException: Unable to create session from {\n “desiredCapabilities”: {\n },\n “capabilities”: {\n
"firstMatch": [\n ]\n },\n “Capabilities”: {\n “browserName”: “Edge”\n }\n}\nBuild info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’\nSystem info: host: ‘DESKTOP-14VQUSG’, ip: ‘192.168.137.1’, os.name: ‘Windows 10’, os.arch: ‘x86’, os.version: ‘10.0’, java.version: ‘1.8.0_251’\nDriver info: driver.version: unknown\r\n\tat org.openqa.selenium.remote.server.NewSessionPipeline.lambda$nullKaTeX parse error: Can't use function '\r' in math mode at position 30: …peline.java:76)\̲r̲\n\tat java.uti…createNewSessionKaTeX parse error: Can't use function '\r' in math mode at position 30: …peline.java:75)\̲r̲\n\tat java.uti…handleKaTeX parse error: Can't use function '\r' in math mode at position 29: …rvlet.java:235)\̲r̲\n\tat java.uti…RunnableAdapter.call(Unknown Source)\r\n\tat java.util.concurrent.FutureTask.run(Unknown Source)\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)\r\n\tat java.util.concurrent.ThreadPoolExecutorKaTeX parse error: Can't use function '\r' in math mode at position 27: …Unknown Source)\̲r̲\n\tat java.lan…nullKaTeX parse error: Expected 'EOF', got '}' at position 90: …lineNumber': 76}̲, {'fileName': …createNewSessionKaTeX parse error: Expected 'EOF', got '}' at position 90: …lineNumber': 75}̲, {'fileName': …handleKaTeX parse error: Expected 'EOF', got '}' at position 89: …ineNumber': 235}̲, {'fileName': …RunnableAdapter’, ‘lineNumber’: -1}, {‘fileName’: None, ‘methodName’: ‘run’, ‘className’: ‘java.util.concurrent.FutureTask’, ‘lineNumber’: -1}, {‘fileName’: None, ‘methodName’: ‘runWorker’, ‘className’: ‘java.util.concurrent.ThreadPoolExecutor’, ‘lineNumber’: -1}, {‘fileName’: None, ‘methodName’: ‘run’, ‘className’: ‘java.util.concurrent.ThreadPoolExecutor$Worker’, ‘lineNumber’: -1}, {‘fileName’: None, ‘methodName’: ‘run’, ‘className’: ‘java.lang.Thread’, ‘lineNumber’: -1}], ‘message’: ‘Unable to create session from {\n “desiredCapabilities”: {\n },\n “capabilities”: {\n “firstMatch”: [\n ]\n },\n “Capabilities”: {\n “browserName”: “Edge”\n }\n}\nBuild info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’\nSystem info: host: ‘DESKTOP-14VQUSG’, ip: ‘192.168.137.1’, os.name: ‘Windows 10’, os.arch: ‘x86’, os.version: ‘10.0’, java.version: ‘1.8.0_251’\nDriver info: driver.version: unknown’, ‘error’: ‘session not created’}, ‘status’: 33}
PS E:\30.Study\30.自动化测试\99.零基础入门 Python Web 自动化测试\10.seleniumCodePractice>