Created
January 24, 2024 07:52
-
-
Save apatheticL/476f75fcc7621ffaeb376350339d969c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
D:\learn\PythonProject\.venv\Scripts\python.exe "C:/Program Files/JetBrains/PyCharm 2023.3.2/plugins/python/helpers/pycharm/_jb_pytest_runner.py" --path D:\learn\PythonProject\Tests\LauchApp.py | |
Testing started at 2:49 PM ... | |
Launching pytest with arguments D:\learn\PythonProject\Tests\LauchApp.py --no-header --no-summary -q in D:\learn\PythonProject\Tests | |
============================= test session starts ============================= | |
collecting ... collected 1 item | |
LauchApp.py::TestAppium::test_find_battery | |
============================= 1 failed in 14.76s ============================== | |
FAILED [100%] | |
LauchApp.py:28 (TestAppium.test_find_battery) | |
self = <LauchApp.TestAppium testMethod=test_find_battery> | |
def test_find_battery(self) -> None: | |
> el = self.driver.find_element(by=AppiumBy.XPATH, value='//*[@text="Battery"]') | |
LauchApp.py:30: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
..\.venv\Lib\site-packages\appium\webdriver\webdriver.py:384: in find_element | |
return self.execute(RemoteCommand.FIND_ELEMENT, {'using': by, 'value': value})['value'] | |
..\.venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py:347: in execute | |
self.error_handler.check_response(response) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <appium.webdriver.errorhandler.MobileErrorHandler object at 0x0000020025D83530> | |
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"An element could not be located on the page u...ode_modules\\\\appium\\\\node_modules\\\\@appium\\\\base-driver\\\\lib\\\\basedriver\\\\commands\\\\find.ts:75:12)"}}'} | |
def check_response(self, response: Dict[str, Any]) -> None: | |
""" | |
https://www.w3.org/TR/webdriver/#errors | |
""" | |
payload = response.get('value', '') | |
if isinstance(payload, dict): | |
payload_dict = payload | |
else: | |
try: | |
payload_dict = json.loads(payload) | |
except (json.JSONDecodeError, TypeError): | |
return | |
if not isinstance(payload_dict, dict): | |
return | |
value = payload_dict.get('value') | |
if not isinstance(value, dict): | |
return | |
error = value.get('error') | |
if not error: | |
return | |
message = value.get('message', error) | |
stacktrace = value.get('stacktrace', '') | |
# In theory, we should also be checking HTTP status codes. | |
# Java client, for example, prints a warning if the actual `error` | |
# value does not match to the response's HTTP status code. | |
exception_class: Type[sel_exceptions.WebDriverException] = ERROR_TO_EXC_MAPPING.get( | |
error, sel_exceptions.WebDriverException | |
) | |
if exception_class is sel_exceptions.WebDriverException and message: | |
if message == 'No such context found.': | |
exception_class = appium_exceptions.NoSuchContextException | |
elif message == 'That command could not be executed in the current context.': | |
exception_class = appium_exceptions.InvalidSwitchToTargetException | |
if exception_class is sel_exceptions.UnexpectedAlertPresentException: | |
raise sel_exceptions.UnexpectedAlertPresentException( | |
msg=message, | |
stacktrace=format_stacktrace(stacktrace), | |
alert_text=value.get('data'), | |
) | |
> raise exception_class(msg=message, stacktrace=format_stacktrace(stacktrace)) | |
E selenium.common.exceptions.NoSuchElementException: Message: An element could not be located on the page using the given search parameters.; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception | |
E Stacktrace: | |
E NoSuchElementError: An element could not be located on the page using the given search parameters. | |
E at AndroidUiautomator2Driver.findElOrEls (C:\Users\tinhn\.appium\node_modules\appium-uiautomator2-driver\node_modules\appium-android-driver\lib\commands\find.ts:87:11) | |
E at processTicksAndRejections (node:internal/process/task_queues:96:5) | |
E at AndroidUiautomator2Driver.findElOrElsWithProcessing (C:\Users\tinhn\AppData\Roaming\nvm\v16.20.0\node_modules\appium\node_modules\@appium\base-driver\lib\basedriver\commands\find.ts:60:12) | |
E at AndroidUiautomator2Driver.findElement (C:\Users\tinhn\AppData\Roaming\nvm\v16.20.0\node_modules\appium\node_modules\@appium\base-driver\lib\basedriver\commands\find.ts:75:12) | |
..\.venv\Lib\site-packages\appium\webdriver\errorhandler.py:125: NoSuchElementException | |
Process finished with exit code 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment