Repository navigation
Conversation
AppiumOptions.__init__ deliberately does not call BaseOptions.__init__,
because Selenium's version also sets pageLoadStrategy to normal, which
would add that capability to every Appium session. It only set up
_caps and _ignore_local_proxy, so the inherited proxy property, which
reads self._proxy, raised:
>>> UiAutomator2Options().proxy
AttributeError: 'UiAutomator2Options' object has no attribute '_proxy'
Initialise _proxy to None, as BaseOptions does. Setting a Selenium
Proxy already worked and still writes the proxy capability; the
default capabilities are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
AppiumOptionsinherits theproxyproperty from Selenium'sBaseOptions, which readsself._proxy.AppiumOptions.__init__does not callBaseOptions.__init__, so_proxyis never set and reading the property fails:Setting
options.proxy = Proxy(...)already worked, because the setter creates the attribute. Reading it before setting it did not.Fix
Set
self._proxy = NoneinAppiumOptions.__init__, asBaseOptions.__init__does.Calling
BaseOptions.__init__instead is not safe. It also callsset_capability('pageLoadStrategy', 'normal'), which would add that capability to every Appium session._proxyis the only attribute thatBaseOptions' properties read and thatAppiumOptionsdid not set. I leftmobile_optionsalone: Appium never reads or sends it.Tests
.proxyisNoneon new options, that setting a SeleniumProxyreturns it from.proxyand sends it as theproxycapability, and that the default capabilities are unchanged (nopageLoadStrategy). Without the fix, the first test fails withAttributeError: 'AppiumOptions' object has no attribute '_proxy'.ruff check,ruff format --check,mypy appiumand the full unit test suite pass.🤖 Generated with Claude Code