Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[py] removed redundant attributes capabilities and set_capability in wpewebkit/options.py #12169

Merged
merged 60 commits into from
Jun 8, 2023
Merged

Conversation

sandeepsuryaprasad
Copy link
Contributor

@sandeepsuryaprasad sandeepsuryaprasad commented Jun 7, 2023

Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.

Description

Removed redundant methods capabilities and set_capability in wpewebkit/options.py
Since Options class in wpewebkit/options.py inherits from ArgOptions, I have removed redundant methods which sets and gets capabilities.

Replaced set_capabilities method with a setter method to add capabilities to self._caps.

Motivation and Context

Since both methods capabilities and set_capability are already implemented in parent class
selenium.webdriver.common.options.ArgOptions, I found that same attributes are being implemented once again in wpewebkit/options.py.

To get the capabilities from internal dictionary self._caps we do have a getter method in
selenium.webdriver.common.options.Options class

@property
def capabilities(self):
return _caps

And the capabilities are being set through set_capabilities method. For the purpose of consistency I have
repalced set_capabilities() method in selenium.webdriver.common.options.Options class to a setter method.

@property.setter
def capabilities(self, values):
name, value = values
self._caps[name] = value

so now the capabilities can be set through setter,

self.capabilities = ("pageLoadStrategy", "normal")

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • [] My change requires a change to the documentation.
  • [] I have updated the documentation accordingly.
  • [] I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov-commenter
Copy link

codecov-commenter commented Jun 7, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.04 🎉

Comparison is base (da3a82b) 56.52% compared to head (229763a) 56.56%.

❗ Current head 229763a differs from pull request most recent head aded1d9. Consider uploading reports for the commit aded1d9 to get more accurate results

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #12169      +/-   ##
==========================================
+ Coverage   56.52%   56.56%   +0.04%     
==========================================
  Files          86       86              
  Lines        5454     5450       -4     
  Branches      223      223              
==========================================
  Hits         3083     3083              
+ Misses       2148     2144       -4     
  Partials      223      223              
Impacted Files Coverage Δ
py/selenium/webdriver/wpewebkit/options.py 50.00% <ø> (+7.69%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

py/selenium/webdriver/common/options.py Outdated Show resolved Hide resolved
Copy link
Member

@diemol diemol left a comment

Choose a reason for hiding this comment

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

Thank you, @sandeepsuryaprasad!

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