Skip to content

Conversation

@KazuCocoa
Copy link
Member

for #865

Still initial implementation.

# TODO: Remove the fallback
return self.mark_extension_absence(ext_name).execute(Command.GET_CURRENT_ACTIVITY)['value']
except WebDriverException as e:
if isinstance(e, UnknownMethodException) or self.is_missing_command(e.msg):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could it be the server throws anything else other than UnknownMethodException in case of missing method?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UnknownMethodException is only raised by

def assert_extension_exists(self, ext_name: str) -> 'WebDriver':
"""
Verifies if the given extension is not present in the list of absent extensions
for the given driver instance.
This API is designed for private usage.
:param ext_name: extension name
:return: self instance for chaining
:raise UnknownMethodException: If the extension has been marked as absent once
"""
if ext_name in self._absent_extensions:
raise UnknownMethodException()
return self
. Serveeer only raised a general error, so python client handled it only as WebDriverException

Copy link
Contributor

@mykola-mokhnach mykola-mokhnach May 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be a bug in the Python client itself. I believe it does not properly map the exception raised by the server because this works as expected with Java

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, then, i guess in selenium client side..? Quickly checked with ruby client. it also actually handled as Selenium::WebDriver::Error::UnknownCommandError. I'll take a look this weekend

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, I have already prepared a fix: #869

Thanks for pointing this out, I did not know it's so broken. Seems like the actual error handling code in selenium client has not been updated since ages and only supports responses in JWP format

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, gotcha. Then this pr is no longer needed

def mark_extension_absence(self: T, ext_name: str) -> T:
...

def is_missing_command(self: T, error_msg: Union[str, None]) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

protocols must not contain method implementations

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, i noticed the implementation was in webdriver.py

@KazuCocoa KazuCocoa closed this May 20, 2023
@KazuCocoa KazuCocoa deleted the fix-error-handling branch May 20, 2023 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants