1 Star 0 Fork 3

上善若水/TestPlatformByYangLiang

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
.report.json 29.33 KB
一键复制 编辑 原始数据 按行查看 历史
yangliang 提交于 2022-12-08 16:25 . add 代码生成器golang实现
{"created": 1669703646.198229, "duration": 283.18517899513245, "exitcode": 1, "root": "F:\\test-platform-by-yang-liang", "environment": {"Python": "3.9.13", "Platform": "Windows-10-10.0.22000-SP0", "Packages": {"pytest": "7.2.0", "pluggy": "1.0.0"}, "Plugins": {"allure-pytest": "2.11.1", "anyio": "3.6.2", "json-report": "1.5.0", "metadata": "2.0.4"}, "JAVA_HOME": "F:\\Java\\jdk1.8.0_301"}, "summary": {"passed": 19, "skipped": 1, "failed": 2, "total": 22, "collected": 22}, "collectors": [{"nodeid": "", "outcome": "passed", "result": [{"nodeid": "testCase/test_api.py", "type": "Module"}]}, {"nodeid": "testCase/test_api.py::TestApi", "outcome": "passed", "result": [{"nodeid": "testCase/test_api.py::TestApi::test_case[case0]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case1]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case2]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case3]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case4]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case5]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case6]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case7]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case8]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case9]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case10]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case11]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case12]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case13]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case14]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case15]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case16]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case17]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case18]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case19]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case20]", "type": "Function", "lineno": 18}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case21]", "type": "Function", "lineno": 18}]}, {"nodeid": "testCase/test_api.py", "outcome": "passed", "result": [{"nodeid": "testCase/test_api.py::TestApi", "type": "Class"}]}], "tests": [{"nodeid": "testCase/test_api.py::TestApi::test_case[case0]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case0]", "parametrize", "pytestmark", "case0", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.014893299999999998, "outcome": "passed"}, "call": {"duration": 0.553023, "outcome": "passed"}, "teardown": {"duration": 0.0007309000000002008, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case1]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case1]", "parametrize", "pytestmark", "case1", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.00036279999999999646, "outcome": "passed"}, "call": {"duration": 0.5478613999999999, "outcome": "passed"}, "teardown": {"duration": 0.0006140999999999508, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case2]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case2]", "parametrize", "pytestmark", "case2", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.0003615999999997399, "outcome": "passed"}, "call": {"duration": 0.5697846000000002, "outcome": "passed"}, "teardown": {"duration": 0.0006033999999996986, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case3]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case3]", "parametrize", "pytestmark", "case3", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.00035779999999974166, "outcome": "passed"}, "call": {"duration": 0.07120250000000006, "outcome": "passed"}, "teardown": {"duration": 0.0005622999999999045, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case4]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case4]", "parametrize", "pytestmark", "case4", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.00036199999999997345, "outcome": "passed"}, "call": {"duration": 0.6186425, "outcome": "passed"}, "teardown": {"duration": 0.0005245999999994311, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case5]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case5]", "parametrize", "pytestmark", "case5", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.0003370000000000317, "outcome": "passed"}, "call": {"duration": 0.6198646000000005, "outcome": "passed"}, "teardown": {"duration": 0.0005663000000000196, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case6]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case6]", "parametrize", "pytestmark", "case6", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.0003213000000004129, "outcome": "passed"}, "call": {"duration": 0.6061483000000001, "outcome": "passed"}, "teardown": {"duration": 0.000568000000000346, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case7]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case7]", "parametrize", "pytestmark", "case7", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.0003541999999994161, "outcome": "passed"}, "call": {"duration": 0.23484809999999978, "outcome": "passed"}, "teardown": {"duration": 0.0005630999999999275, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case8]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case8]", "parametrize", "pytestmark", "case8", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.00033870000000035816, "outcome": "passed"}, "call": {"duration": 1.6364220999999999, "outcome": "passed"}, "teardown": {"duration": 0.0008743999999998309, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case9]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case9]", "parametrize", "pytestmark", "case9", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.0003604999999993197, "outcome": "passed"}, "call": {"duration": 120.0342567, "outcome": "passed"}, "teardown": {"duration": 0.0007018999999957032, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case10]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case10]", "parametrize", "pytestmark", "case10", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.00040320000000804157, "outcome": "passed"}, "call": {"duration": 0.04056160000000375, "outcome": "passed"}, "teardown": {"duration": 0.0005790000000018836, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case11]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case11]", "parametrize", "pytestmark", "case11", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.00033820000000162054, "outcome": "passed"}, "call": {"duration": 0.12356610000000501, "outcome": "passed"}, "teardown": {"duration": 0.0007994999999993979, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case12]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case12]", "parametrize", "pytestmark", "case12", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.0003785000000107175, "outcome": "passed"}, "call": {"duration": 0.6943363999999832, "outcome": "passed"}, "teardown": {"duration": 0.000591700000001083, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case13]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case13]", "parametrize", "pytestmark", "case13", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.0003348000000187312, "outcome": "passed"}, "call": {"duration": 0.6106672999999887, "outcome": "passed"}, "teardown": {"duration": 0.000557200000002922, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case14]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case14]", "parametrize", "pytestmark", "case14", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.0003228999999862481, "outcome": "passed"}, "call": {"duration": 0.6851192000000026, "outcome": "passed"}, "teardown": {"duration": 0.0007098000000098637, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case15]", "lineno": 18, "outcome": "skipped", "keywords": ["test_case[case15]", "parametrize", "skip", "pytestmark", "case15", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.00015959999998926833, "outcome": "skipped", "longrepr": "('F:\\\\test-platform-by-yang-liang\\\\testCase\\\\test_api.py', 19, 'Skipped: skip')"}, "teardown": {"duration": 0.00013649999999643114, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case16]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case16]", "parametrize", "pytestmark", "case16", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.0002843000000041229, "outcome": "passed"}, "call": {"duration": 0.07038620000000151, "outcome": "passed"}, "teardown": {"duration": 0.0009594999999933407, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case17]", "lineno": 18, "outcome": "failed", "keywords": ["test_case[case17]", "parametrize", "pytestmark", "case17", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.00036350000002016714, "outcome": "passed"}, "call": {"duration": 120.5944696, "outcome": "failed", "crash": {"path": "F:\\test-platform-by-yang-liang\\service\\apiService.py", "lineno": 279, "message": "AssertionError"}, "traceback": [{"path": "testCase\\test_api.py", "lineno": 24, "message": ""}, {"path": "service\\apiService.py", "lineno": 423, "message": "in run_api"}, {"path": "service\\apiService.py", "lineno": 279, "message": "AssertionError"}], "longrepr": "self = <testCase.test_api.TestApi object at 0x0000026ECE1A6EE0>\ncase = {'actual_result_template': \"{'inventory': $inventory, 'sales': $sales}\", 'actual_results': \"{'inventory': 4297, 'sales': 82}\", 'after_handle': None, 'assert_info': None, ...}\n\n @pytest.mark.parametrize('case', ExcelHandle(\"dataSource/full_stack_test.xlsx\").get_data())\n def test_case(self, case: dict):\n allure.dynamic.feature(case[\"current_info\"][\"sheet\"])\n allure.dynamic.title(case[\"title\"])\n \n> self.api.run_api(case)\n\ntestCase\\test_api.py:24: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\nservice\\apiService.py:423: in run_api\n self.update_execl(case[\"assert_info\"], case[\"expected_results\"], case[\"actual_result_template\"],\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n\nself = <service.apiService.ApiService object at 0x0000026ECE1A65B0>\nassert_info = None\nexpected_results = '{\\n \"inventory\":reduce_value($inventory, $goods_num),\\n \"sales\":sum_value($sales, $goods_num)\\n}'\nactual_result_template = \"{'inventory': $inventory, 'sales': $sales}\"\nactual_results = \"{'inventory': 4297, 'sales': 82}\"\nresult = {'inventory': 4297, 'sales': 82}\ncurrent_info = {'row': 19, 'sheet': '\u5f55\u5236\u6570\u636e'}, resp = <Response [200 OK]>\nelement = None\n\n def update_execl(self, assert_info: str, expected_results: str, actual_result_template: str,\n actual_results: str, result, current_info: dict,\n resp: Union[Response, List], element: Union[WebElement, AppElement, BaseElementType]):\n initial = result\n try:\n # if expected_results != \"\" and expected_results is not None and ident[\"end\"] is False:\n if expected_results != \"\" and expected_results is not None:\n self.adh.recursive_search_key(initial, True)\n \n if assert_info != \"\" and assert_info is not None:\n result = {}\n self.report_details(\"\u65ad\u8a00(\u9884\u671f:\u5b9e\u9645)\", self.adh.result_assertion_by_dict(assert_info, resp, element, result))\n \n except AssertionError:\n self.screenshot(element)\n \n whether = \"fail\"\n color = \"FFC125\"\n \n else:\n whether = \"pass\"\n color = \"AACF91\"\n \n if (assert_info == \"\" or assert_info is None) and expected_results != \"\" and expected_results is not None:\n # result = self.adh.matching_variable(actual_result_template)\n result = self.adh.new_matching_variable(actual_result_template)\n self.report_details(\"\u65ad\u8a00\", {\n \"\u9884\u671f\": initial,\n \"\u5b9e\u9645\": result\n })\n \n self.update_whether(current_info, result, whether, color)\n \n self.update_last_error(assert_info, expected_results, actual_results, current_info)\n \n self.save_excel()\n \n if whether == \"fail\":\n> raise AssertionError\nE AssertionError\n\nservice\\apiService.py:279: AssertionError"}, "teardown": {"duration": 0.0006702000000018415, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case18]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case18]", "parametrize", "pytestmark", "case18", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.0003826999999887448, "outcome": "passed"}, "call": {"duration": 10.465049600000015, "outcome": "passed"}, "teardown": {"duration": 0.0005654999999933352, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case19]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case19]", "parametrize", "pytestmark", "case19", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.00035680000002003, "outcome": "passed"}, "call": {"duration": 10.080183000000034, "outcome": "passed"}, "teardown": {"duration": 0.0007220999999617561, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case20]", "lineno": 18, "outcome": "passed", "keywords": ["test_case[case20]", "parametrize", "pytestmark", "case20", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.0005076999999573673, "outcome": "passed"}, "call": {"duration": 1.9246752999999899, "outcome": "passed"}, "teardown": {"duration": 0.0008976999999958934, "outcome": "passed"}}, {"nodeid": "testCase/test_api.py::TestApi::test_case[case21]", "lineno": 18, "outcome": "failed", "keywords": ["test_case[case21]", "parametrize", "pytestmark", "case21", "TestApi", "test_api.py", "testCase/__init__.py", "test-platform-by-yang-liang"], "setup": {"duration": 0.0003938000000403008, "outcome": "passed"}, "call": {"duration": 10.760346900000002, "outcome": "failed", "crash": {"path": "F:\\Python\\Python39\\lib\\site-packages\\selenium\\webdriver\\remote\\errorhandler.py", "lineno": 249, "message": "selenium.common.exceptions.NoSuchElementException: Message: An element could not be located on the page using the given search parameters.\nStacktrace:\nNoSuchElementError: An element could not be located on the page using the given search parameters.\n at AndroidUiautomator2Driver.findElOrEls (F:\\Appium-windows-1.21.0\\resources\\app\\node_modules\\appium\\node_modules\\appium-android-driver\\lib\\commands\\find.js:75:11)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (internal/process/task_queues.js:85:5)"}, "traceback": [{"path": "testCase\\test_api.py", "lineno": 24, "message": ""}, {"path": "service\\apiService.py", "lineno": 414, "message": "in run_api"}, {"path": "service\\apiService.py", "lineno": 404, "message": "in run_api"}, {"path": "service\\apiService.py", "lineno": 385, "message": "in implement_case"}, {"path": "service\\apiService.py", "lineno": 169, "message": "in operation_element"}, {"path": "handle\\uiDependent.py", "lineno": 13, "message": "in get_element_all"}, {"path": "F:\\Python\\Python39\\lib\\site-packages\\appium\\webdriver\\webdriver.py", "lineno": 371, "message": "in find_element"}, {"path": "F:\\Python\\Python39\\lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py", "lineno": 444, "message": "in execute"}, {"path": "F:\\Python\\Python39\\lib\\site-packages\\appium\\webdriver\\errorhandler.py", "lineno": 30, "message": "in check_response"}, {"path": "F:\\Python\\Python39\\lib\\site-packages\\appium\\webdriver\\errorhandler.py", "lineno": 26, "message": "in check_response"}, {"path": "F:\\Python\\Python39\\lib\\site-packages\\selenium\\webdriver\\remote\\errorhandler.py", "lineno": 249, "message": "NoSuchElementException"}], "longrepr": "self = <testCase.test_api.TestApi object at 0x0000026ECE1A6250>\ncase = {'actual_result_template': None, 'actual_results': 'NoSuchElementException()', 'after_handle': None, 'assert_info': '{\\n \"$price\": (\"get_attribute\", \"content-desc\")\\n}', ...}\n\n @pytest.mark.parametrize('case', ExcelHandle(\"dataSource/full_stack_test.xlsx\").get_data())\n def test_case(self, case: dict):\n allure.dynamic.feature(case[\"current_info\"][\"sheet\"])\n allure.dynamic.title(case[\"title\"])\n \n> self.api.run_api(case)\n\ntestCase\\test_api.py:24: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\nservice\\apiService.py:414: in run_api\n raise e\nservice\\apiService.py:404: in run_api\n result, resp, element = self.implement_case(**case)\nservice\\apiService.py:385: in implement_case\n element = self.operation_element(driver_info, element_info, extract_var, var_name, need_data)\nservice\\apiService.py:169: in operation_element\n element = self.udh.get_element_all(self.driver, *k)\nhandle\\uiDependent.py:13: in get_element_all\n return driver.find_element(*args)\nF:\\Python\\Python39\\lib\\site-packages\\appium\\webdriver\\webdriver.py:371: in find_element\n return self.execute(RemoteCommand.FIND_ELEMENT, {'using': by, 'value': value})['value']\nF:\\Python\\Python39\\lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py:444: in execute\n self.error_handler.check_response(response)\nF:\\Python\\Python39\\lib\\site-packages\\appium\\webdriver\\errorhandler.py:30: in check_response\n raise wde\nF:\\Python\\Python39\\lib\\site-packages\\appium\\webdriver\\errorhandler.py:26: in check_response\n super().check_response(response)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n\nself = <appium.webdriver.errorhandler.MobileErrorHandler object at 0x0000026ECE2E7E50>\nresponse = {'status': 404, 'value': '{\"value\":{\"error\":\"no such element\",\"message\":\"An element could not be located on the page u...11)\\\\n at runMicrotasks (<anonymous>)\\\\n at processTicksAndRejections (internal/process/task_queues.js:85:5)\"}}'}\n\n def check_response(self, response: Dict[str, Any]) -> None:\n \"\"\"\n Checks that a JSON response from the WebDriver does not have an error.\n \n :Args:\n - response - The JSON response from the WebDriver server as a dictionary\n object.\n \n :Raises: If the response contains an error message.\n \"\"\"\n status = response.get(\"status\", None)\n if not status or status == ErrorCode.SUCCESS:\n return\n value = None\n message = response.get(\"message\", \"\")\n screen: str = response.get(\"screen\", \"\")\n stacktrace = None\n if isinstance(status, int):\n value_json = response.get(\"value\", None)\n if value_json and isinstance(value_json, str):\n import json\n \n try:\n value = json.loads(value_json)\n if len(value.keys()) == 1:\n value = value[\"value\"]\n status = value.get(\"error\", None)\n if not status:\n status = value.get(\"status\", ErrorCode.UNKNOWN_ERROR)\n message = value.get(\"value\") or value.get(\"message\")\n if not isinstance(message, str):\n value = message\n message = message.get(\"message\")\n else:\n message = value.get(\"message\", None)\n except ValueError:\n pass\n \n exception_class: Type[WebDriverException]\n if status in ErrorCode.NO_SUCH_ELEMENT:\n exception_class = NoSuchElementException\n elif status in ErrorCode.NO_SUCH_FRAME:\n exception_class = NoSuchFrameException\n elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:\n exception_class = NoSuchShadowRootException\n elif status in ErrorCode.NO_SUCH_WINDOW:\n exception_class = NoSuchWindowException\n elif status in ErrorCode.STALE_ELEMENT_REFERENCE:\n exception_class = StaleElementReferenceException\n elif status in ErrorCode.ELEMENT_NOT_VISIBLE:\n exception_class = ElementNotVisibleException\n elif status in ErrorCode.INVALID_ELEMENT_STATE:\n exception_class = InvalidElementStateException\n elif (\n status in ErrorCode.INVALID_SELECTOR\n or status in ErrorCode.INVALID_XPATH_SELECTOR\n or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER\n ):\n exception_class = InvalidSelectorException\n elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:\n exception_class = ElementNotSelectableException\n elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:\n exception_class = ElementNotInteractableException\n elif status in ErrorCode.INVALID_COOKIE_DOMAIN:\n exception_class = InvalidCookieDomainException\n elif status in ErrorCode.UNABLE_TO_SET_COOKIE:\n exception_class = UnableToSetCookieException\n elif status in ErrorCode.TIMEOUT:\n exception_class = TimeoutException\n elif status in ErrorCode.SCRIPT_TIMEOUT:\n exception_class = TimeoutException\n elif status in ErrorCode.UNKNOWN_ERROR:\n exception_class = WebDriverException\n elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:\n exception_class = UnexpectedAlertPresentException\n elif status in ErrorCode.NO_ALERT_OPEN:\n exception_class = NoAlertPresentException\n elif status in ErrorCode.IME_NOT_AVAILABLE:\n exception_class = ImeNotAvailableException\n elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:\n exception_class = ImeActivationFailedException\n elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:\n exception_class = MoveTargetOutOfBoundsException\n elif status in ErrorCode.JAVASCRIPT_ERROR:\n exception_class = JavascriptException\n elif status in ErrorCode.SESSION_NOT_CREATED:\n exception_class = SessionNotCreatedException\n elif status in ErrorCode.INVALID_ARGUMENT:\n exception_class = InvalidArgumentException\n elif status in ErrorCode.NO_SUCH_COOKIE:\n exception_class = NoSuchCookieException\n elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:\n exception_class = ScreenshotException\n elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:\n exception_class = ElementClickInterceptedException\n elif status in ErrorCode.INSECURE_CERTIFICATE:\n exception_class = InsecureCertificateException\n elif status in ErrorCode.INVALID_COORDINATES:\n exception_class = InvalidCoordinatesException\n elif status in ErrorCode.INVALID_SESSION_ID:\n exception_class = InvalidSessionIdException\n elif status in ErrorCode.UNKNOWN_METHOD:\n exception_class = UnknownMethodException\n else:\n exception_class = WebDriverException\n if not value:\n value = response[\"value\"]\n if isinstance(value, str):\n raise exception_class(value)\n if message == \"\" and \"message\" in value:\n message = value[\"message\"]\n \n screen = None # type: ignore[assignment]\n if \"screen\" in value:\n screen = value[\"screen\"]\n \n stacktrace = None\n st_value = value.get(\"stackTrace\") or value.get(\"stacktrace\")\n if st_value:\n if isinstance(st_value, str):\n stacktrace = st_value.split(\"\\n\")\n else:\n stacktrace = []\n try:\n for frame in st_value:\n line = frame.get(\"lineNumber\", \"\")\n file = frame.get(\"fileName\", \"<anonymous>\")\n if line:\n file = f\"{file}:{line}\"\n meth = frame.get(\"methodName\", \"<anonymous>\")\n if \"className\" in frame:\n meth = \"{}.{}\".format(frame[\"className\"], meth)\n msg = \" at %s (%s)\"\n msg = msg % (meth, file)\n stacktrace.append(msg)\n except TypeError:\n pass\n if exception_class == UnexpectedAlertPresentException:\n alert_text = None\n if \"data\" in value:\n alert_text = value[\"data\"].get(\"text\")\n elif \"alert\" in value:\n alert_text = value[\"alert\"].get(\"text\")\n raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here\n> raise exception_class(message, screen, stacktrace)\nE selenium.common.exceptions.NoSuchElementException: Message: An element could not be located on the page using the given search parameters.\nE Stacktrace:\nE NoSuchElementError: An element could not be located on the page using the given search parameters.\nE at AndroidUiautomator2Driver.findElOrEls (F:\\Appium-windows-1.21.0\\resources\\app\\node_modules\\appium\\node_modules\\appium-android-driver\\lib\\commands\\find.js:75:11)\nE at runMicrotasks (<anonymous>)\nE at processTicksAndRejections (internal/process/task_queues.js:85:5)\n\nF:\\Python\\Python39\\lib\\site-packages\\selenium\\webdriver\\remote\\errorhandler.py:249: NoSuchElementException"}, "teardown": {"duration": 0.5442499999999768, "outcome": "passed", "log": [{"name": "run_case", "msg": "WebDriverException()", "args": null, "levelname": "DEBUG", "levelno": 10, "pathname": "F:\\test-platform-by-yang-liang\\testCase\\test_api.py", "filename": "test_api.py", "module": "test_api", "exc_info": null, "exc_text": null, "stack_info": null, "lineno": 37, "funcName": "teardown_class", "created": 1669703645.6647065, "msecs": 664.7064685821533, "relativeCreated": 283553.56645584106, "thread": 13036, "threadName": "MainThread", "processName": "MainProcess", "process": 19452, "asctime": "2022-11-29 14:34:05,664"}, {"name": "run_case", "msg": "\u90ae\u4ef6\u53d1\u9001\u6210\u529f", "args": null, "levelname": "DEBUG", "levelno": 10, "pathname": "F:\\test-platform-by-yang-liang\\emails\\mail.py", "filename": "mail.py", "module": "mail", "exc_info": null, "exc_text": null, "stack_info": null, "lineno": 40, "funcName": "send_emails", "created": 1669703646.1894312, "msecs": 189.43119049072266, "relativeCreated": 284078.29117774963, "thread": 13036, "threadName": "MainThread", "processName": "MainProcess", "process": 19452, "asctime": "2022-11-29 14:34:06,189"}]}}], "warnings": [{"message": "invalid escape sequence \\G", "category": "DeprecationWarning", "when": "runtest", "filename": "<string>", "lineno": 2}, {"message": "use options instead of chrome_options", "category": "DeprecationWarning", "when": "runtest", "filename": "F:\\test-platform-by-yang-liang\\service\\apiService.py", "lineno": 122}, {"message": "desired_capabilities has been deprecated, please pass in an Options object with options kwarg", "category": "DeprecationWarning", "when": "runtest", "filename": "F:\\Python\\Python39\\lib\\site-packages\\appium\\webdriver\\webdriver.py", "lineno": 230}]}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/civins/TestPlatformByYangLiang.git
git@gitee.com:civins/TestPlatformByYangLiang.git
civins
TestPlatformByYangLiang
TestPlatformByYangLiang
master

搜索帮助