Skip to content

Unlike RemoteWebDriver, AppiumDriver constructors don't allow user-provided CommandExecutor #276

New issue

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

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

Already on GitHub? # to your account

Closed
baechul opened this issue Dec 1, 2015 · 7 comments

Comments

@baechul
Copy link

baechul commented Dec 1, 2015

There is a usecase where I need to have an AppiumCommandExecutor constructed with my HttpClient.Factory then pass it to the AppiumDriver constructors. Not limited to this case only but the usecase I have is to add some extra headers to the underlaying RemoteWebDriver HttpRequests by overriding HttpClient execute method in my HttpClient.Factory.

Some enterprise companies have a service gateway that requires an auth headers. We can make the desktop browser RemoteWebDriver requests pass the gateway with the required headers because RemoteWebDriver allows my CommandExecutor. The same is blocked with Appium RemoteWebDriver.

Please add additional AppiumDriver const which takes user-provided CommandExecutor.

@TikhomirovSergey
Copy link
Contributor

Sounds meaningful 👍

@Jonahss
Copy link
Member

Jonahss commented Dec 1, 2015

Good point. We provide our own command-executor to RemoteWebDriver in order to get appium to work, and the chain shouldn't end with us.

@baechul Do you want to work on this and submit a pull request?

@baechul
Copy link
Author

baechul commented Dec 1, 2015

I am trying to contribute by sending a pull request but I can't find the contribution guide page. Just running "mvn clean install" failed out of the master branch. I am on osx. Is there contribution guide with build/configuration instruction?

@TikhomirovSergey
Copy link
Contributor

I think there there should be one or few public constructors that can pass user's CommandExecutor.

Maybe... Does it make sense to use only HttpCommandExecutor extensions instead of CommandExecutor implementations? This way the number of constructors can be reduced,

@baechul
Copy link
Author

baechul commented Dec 1, 2015

I have updates to be contributed back. I tested locally and seems working fine. The way I have updated is to allow for users to pass a custom HttpClient.Factory to AndroidDriver/IOSDriver const. The passed HttpClient.Factory is consumed by the existing AppiumCammandExecutor class. Idea was to reuse AppiumCammandExecutor but just allow users to pass own wrapper of HttpClient so that extra headers can be injected.

Example of AndroidDriver additional const:
public AndroidDriver(URL remoteAddress, HttpClient.Factory httpClientFactory, Capabilities desiredCapabilities)

I will send the pull request soon for the community reviews.

@TikhomirovSergey
Copy link
Contributor

Fixed and it is going to be published

@baechul
Copy link
Author

baechul commented Dec 8, 2015

Great! Thanks.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants