Skip to content

Conversation

KazuCocoa
Copy link
Member

@KazuCocoa KazuCocoa commented Aug 5, 2022

Change list

Current Java client does not have a way to generates a http client with ClientConfig clientConfig.
When we give URL remoteAddress to the AppiumDriver, it generates a default clientConfig as below to create a http client instance. So, in case users want to configure proxy etc to the http client, they need to define their own http factory method for now.

                        ClientConfig.defaultConfig()
                                .baseUrl(Require.nonNull("Server URL", ofNullable(service)
                                        .map(DriverService::getUrl)
                                        .orElse(addressOfRemoteServer)))
                                .readTimeout(DEFAULT_READ_TIMEOUT),

It seems like recent selenium v4 java client allows users to configure the http client (with the default netty client) by giving clientConfig like:

ClientConfig config = ClientConfig.defaultConfig()
        .connectionTimeout(Duration.ofMinutes(5))
        .readTimeout(Duration.ofMinutes(3));

WebDriver driver = RemoteWebDriver.builder()
        .oneOf(browserOptions)
        .setCapability("sauce:options", sauceOptions)
        .address("https://ondemand.us-west-1.saucelabs.com/wd/hub")
        .config(config)
        .build();

https://docs.saucelabs.com/web-apps/automated-testing/selenium/selenium4/

Current out method does not provide the same syntax, but it would be worth giving users to configure the http client with ClientConfig without defining HTTP factory method. Many examples in the internet explain factory method with okhttp, but selenium v4 no longer supports okhttp by default. So this ClientConfig method helps users to configure client proxy etc than defining their own factory.

In case a user wants to define their own http client, they can use existing method to start a driver with HttpClient.Factory

Types of changes

What types of changes are you proposing/introducing to Java client?
Put an x in the boxes that apply

  • No changes in production code.
  • Bugfix (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 not work as expected)

@mykola-mokhnach mykola-mokhnach merged commit 938a4db into appium:master Aug 5, 2022
@KazuCocoa KazuCocoa deleted the allow-client-config branch August 5, 2022 20:53
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.

4 participants