Skip to content

Commit 2942f7c

Browse files
authored
feat: drop /wd/hub from the default path (#592)
* feat: drop /wd/hub from the default path * update changelog
1 parent 720be21 commit 2942f7c

10 files changed

Lines changed: 88 additions & 87 deletions

File tree

.github/workflows/functional-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
appium driver install xcuitest
6969
appium plugin install images
7070
appium plugin install execute-driver
71-
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors --base-path=/wd/hub 2>&1 > appium.log &
71+
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors 2>&1 > appium.log &
7272
7373
- name: Set up Ruby
7474
uses: ruby/setup-ruby@v1
@@ -131,7 +131,7 @@ jobs:
131131
appium driver install xcuitest
132132
appium plugin install images@2.1.8
133133
appium plugin install execute-driver
134-
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors --base-path=/wd/hub > appium.log &
134+
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors > appium.log &
135135
136136
- name: Set up Ruby
137137
uses: ruby/setup-ruby@v1
@@ -216,7 +216,7 @@ jobs:
216216
appium driver install ${{matrix.test_targets.automation_name}}
217217
appium plugin install images
218218
appium plugin install execute-driver
219-
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors --base-path=/wd/hub > appium.log &
219+
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors > appium.log &
220220
221221
- name: Enable KVM group perms
222222
run: |

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Read `release_notes.md` for commit level details.
99
### Bug fixes
1010

1111
### Deprecations
12+
- Use `http://127.0.0.1:4723` as the default url destination instead of `http://127.0.0.1:4723/wd/hub`
1213

1314
## [9.5.2] - 2025-01-30
1415
- Fix yardoc

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Run functional tests which require the Appium server and real device, Simulator/
4949
$ npm install --location=global appium
5050
$ appium driver install xcuitest
5151
$ appium driver install uiautomator2 # etc
52-
$ appium --base-path=/wd/hub --relaxed-security # To run all tests in local
52+
$ appium --relaxed-security # To run all tests in local
5353
```
5454

5555
- Conduct tests
@@ -146,7 +146,7 @@ As of version 5.8.0, the client can attach to an existing session. The main purp
146146

147147
```ruby
148148
# @driver is the driver instance of an existing session
149-
attached_driver = ::Appium::Core::Driver.attach_to @driver.session_id, url: 'http://127.0.0.1:4723/wd/hub', automation_name: 'XCUITest', platform_name: 'ios'
149+
attached_driver = ::Appium::Core::Driver.attach_to @driver.session_id, url: 'http://127.0.0.1:4723', automation_name: 'XCUITest', platform_name: 'ios'
150150
assert attached_driver.session_id == @driver.session_id
151151
attached_driver.page_source
152152
```

lib/appium_lib_core/common/base/bridge.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def browser
6868
#
6969
# new_driver = ::Appium::Core::Driver.attach_to(
7070
# driver.session_id,
71-
# url: 'http://127.0.0.1:4723/wd/hub', automation_name: 'UiAutomator2', platform_name: 'Android'
71+
# url: 'http://127.0.0.1:4723', automation_name: 'UiAutomator2', platform_name: 'Android'
7272
# )
7373
#
7474
def attach_to(session_id, platform_name, automation_name)

lib/appium_lib_core/driver.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class Driver
129129
attr_reader :automation_name
130130

131131
# Custom URL for the selenium server. If set this attribute, ruby_lib_core try to handshake to the custom url.<br>
132-
# Defaults to false. Then try to connect to <code>http://127.0.0.1:#{port}/wd/hub</code>.
132+
# Defaults to false. Then try to connect to <code>http://127.0.0.1:#{port}</code>.
133133
# @return [String]
134134
attr_reader :custom_url
135135

@@ -196,7 +196,7 @@ class Driver
196196
# # format 1
197197
# @core = Appium::Core.for caps: {...}, appium_lib: {...}
198198
# # format 2. 'capabilities:' is also available instead of 'caps:'.
199-
# @core = Appium::Core.for url: "http://127.0.0.1:8080/wd/hub", capabilities: {...}, appium_lib: {...}
199+
# @core = Appium::Core.for url: "http://127.0.0.1:8080", capabilities: {...}, appium_lib: {...}
200200
#
201201
#
202202
# require 'rubygems'
@@ -220,7 +220,7 @@ class Driver
220220
# }
221221
# }
222222
# @core = Appium::Core.for(opts) # create a core driver with 'opts' and extend methods into 'self'
223-
# @core.start_driver # Connect to 'http://127.0.0.1:8080/wd/hub' because of 'port: 8080'
223+
# @core.start_driver # Connect to 'http://127.0.0.1:8080' because of 'port: 8080'
224224
#
225225
# # Start iOS driver with .zip file over HTTP
226226
# # 'capabilities:' is also available instead of 'caps:'. Either is fine.
@@ -233,19 +233,19 @@ class Driver
233233
# app: 'http://example.com/path/to/MyiOS.app.zip'
234234
# },
235235
# appium_lib: {
236-
# server_url: 'http://custom-host:8080/wd/hub.com',
236+
# server_url: 'http://custom-host:8080/wd/hub',
237237
# wait: 0,
238238
# wait_timeout: 20,
239239
# wait_interval: 0.3,
240240
# listener: nil,
241241
# }
242242
# }
243243
# @core = Appium::Core.for(opts)
244-
# @core.start_driver # Connect to 'http://custom-host:8080/wd/hub.com'
244+
# @core.start_driver # Connect to 'http://custom-host:8080/wd/hub'
245245
#
246246
# # Start iOS driver as another format. 'url' is available like below
247247
# opts = {
248-
# url: "http://custom-host:8080/wd/hub.com",
248+
# url: "http://custom-host:8080/wd/hub",
249249
# capabilities: {
250250
# platformName: :ios,
251251
# platformVersion: '11.0',
@@ -261,7 +261,7 @@ class Driver
261261
# }
262262
# }
263263
# @core = Appium::Core.for(opts) # create a core driver with 'opts' and extend methods into 'self'
264-
# @core.start_driver # start driver with 'url'. Connect to 'http://custom-host:8080/wd/hub.com'
264+
# @core.start_driver # start driver with 'url'. Connect to 'http://custom-host:8080/wd/hub'
265265
#
266266
# # With a custom listener
267267
# class CustomListener < ::Selenium::WebDriver::Support::AbstractEventListener
@@ -300,7 +300,7 @@ def self.for(opts = {})
300300
#
301301
# new_driver = ::Appium::Core::Driver.attach_to(
302302
# driver.session_id, # The 'driver' has an existing session id
303-
# url: 'http://127.0.0.1:4723/wd/hub', automation_name: 'UiAutomator2', platform_name: 'Android'
303+
# url: 'http://127.0.0.1:4723', automation_name: 'UiAutomator2', platform_name: 'Android'
304304
# )
305305
# new_driver.page_source # for example
306306
#
@@ -352,7 +352,7 @@ def setup_for_new_session(opts = {})
352352
# Creates a new global driver and quits the old one if it exists.
353353
# You can customise http_client as the following
354354
#
355-
# @param [String] server_url Custom server url to send to requests. Default is "http://127.0.0.1:4723/wd/hub".
355+
# @param [String] server_url Custom server url to send to requests. Default is "http://127.0.0.1:4723".
356356
# @param http_client_ops [Hash] Options for http client
357357
# @option http_client_ops [Hash] :http_client Custom HTTP Client
358358
# @option http_client_ops [Hash] :open_timeout Custom open timeout for http client.
@@ -383,18 +383,18 @@ def setup_for_new_session(opts = {})
383383
# }
384384
#
385385
# @core = Appium::Core.for(opts) # create a core driver with 'opts' and extend methods into 'self'
386-
# @driver = @core.start_driver server_url: "http://127.0.0.1:8000/wd/hub"
386+
# @driver = @core.start_driver server_url: "http://127.0.0.1:8000"
387387
#
388388
# # Attach custom HTTP client
389-
# @driver = @core.start_driver server_url: "http://127.0.0.1:8000/wd/hub",
389+
# @driver = @core.start_driver server_url: "http://127.0.0.1:8000",
390390
# http_client_ops: { http_client: Your:Http:Client.new,
391391
# open_timeout: 1_000,
392392
# read_timeout: 1_000 }
393393
#
394394

395395
def start_driver(server_url: nil,
396396
http_client_ops: { http_client: nil, open_timeout: 999_999, read_timeout: 999_999 })
397-
@custom_url ||= "http://127.0.0.1:#{@port}/wd/hub"
397+
@custom_url ||= "http://127.0.0.1:#{@port}"
398398
@custom_url = server_url unless server_url.nil?
399399

400400
@http_client = get_http_client http_client: http_client_ops.delete(:http_client),

test/test_helper.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,8 @@ def udid_name
419419

420420
module Mock
421421
HEADER = { 'Content-Type' => 'application/json; charset=utf-8', 'Cache-Control' => 'no-cache' }.freeze
422-
NOSESSION = 'http://127.0.0.1:4723/wd/hub'
423-
SESSION = 'http://127.0.0.1:4723/wd/hub/session/1234567890'
422+
NOSESSION = 'http://127.0.0.1:4723'
423+
SESSION = 'http://127.0.0.1:4723/session/1234567890'
424424

425425
def android_mock_create_session
426426
android_mock_create_session_w3c
@@ -443,7 +443,7 @@ def android_mock_create_session_w3c
443443
}
444444
}.to_json
445445

446-
stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session')
446+
stub_request(:post, 'http://127.0.0.1:4723/session')
447447
.to_return(headers: HEADER, status: 200, body: response)
448448

449449
stub_request(:post, "#{SESSION}/timeouts")
@@ -457,7 +457,7 @@ def android_mock_create_session_w3c
457457
assert_equal({}, driver.send(:bridge).http.additional_headers)
458458
assert_requested(
459459
:post,
460-
'http://127.0.0.1:4723/wd/hub/session',
460+
'http://127.0.0.1:4723/session',
461461
headers: {
462462
'X-Idempotency-Key' => /.+/,
463463
'Content-Type' => 'application/json; charset=UTF-8',
@@ -500,7 +500,7 @@ def android_chrome_mock_create_session_w3c
500500
}
501501
}.to_json
502502

503-
stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session')
503+
stub_request(:post, 'http://127.0.0.1:4723/session')
504504
.to_return(headers: HEADER, status: 200, body: response)
505505

506506
stub_request(:post, "#{SESSION}/timeouts")
@@ -512,7 +512,7 @@ def android_chrome_mock_create_session_w3c
512512
assert_equal({}, driver.send(:bridge).http.additional_headers)
513513
assert_requested(
514514
:post,
515-
'http://127.0.0.1:4723/wd/hub/session',
515+
'http://127.0.0.1:4723/session',
516516
headers: {
517517
'X-Idempotency-Key' => /.+/,
518518
'Content-Type' => 'application/json; charset=UTF-8',
@@ -558,14 +558,14 @@ def ios_mock_create_session_w3c
558558
}
559559
}.to_json
560560

561-
stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session')
561+
stub_request(:post, 'http://127.0.0.1:4723/session')
562562
.to_return(headers: HEADER, status: 200, body: response)
563563

564564
driver = @core.start_driver
565565

566566
assert_requested(
567567
:post,
568-
'http://127.0.0.1:4723/wd/hub/session',
568+
'http://127.0.0.1:4723/session',
569569
headers: {
570570
'X-Idempotency-Key' => /.+/,
571571
'Content-Type' => 'application/json; charset=UTF-8',
@@ -589,14 +589,14 @@ def windows_mock_create_session
589589
}
590590
}.to_json
591591

592-
stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session')
592+
stub_request(:post, 'http://127.0.0.1:4723/session')
593593
.to_return(headers: HEADER, status: 200, body: response)
594594

595595
driver = @core.start_driver
596596

597597
assert_requested(
598598
:post,
599-
'http://127.0.0.1:4723/wd/hub/session',
599+
'http://127.0.0.1:4723/session',
600600
headers: {
601601
'X-Idempotency-Key' => /.+/,
602602
'Content-Type' => 'application/json; charset=UTF-8',
@@ -620,14 +620,14 @@ def windows_mock_create_session_w3c
620620
}
621621
}.to_json
622622

623-
stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session')
623+
stub_request(:post, 'http://127.0.0.1:4723/session')
624624
.to_return(headers: HEADER, status: 200, body: response)
625625

626626
driver = @core.start_driver
627627

628628
assert_requested(
629629
:post,
630-
'http://127.0.0.1:4723/wd/hub/session',
630+
'http://127.0.0.1:4723/session',
631631
headers: {
632632
'X-Idempotency-Key' => /.+/,
633633
'Content-Type' => 'application/json; charset=UTF-8',
@@ -649,14 +649,14 @@ def mac2_mock_create_session_w3c
649649
}
650650
}.to_json
651651

652-
stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session')
652+
stub_request(:post, 'http://127.0.0.1:4723/session')
653653
.to_return(headers: HEADER, status: 200, body: response)
654654

655655
driver = @core.start_driver
656656

657657
assert_requested(
658658
:post,
659-
'http://127.0.0.1:4723/wd/hub/session',
659+
'http://127.0.0.1:4723/session',
660660
headers: {
661661
'X-Idempotency-Key' => /.+/,
662662
'Content-Type' => 'application/json; charset=UTF-8',

test/unit/android/webdriver/w3c/commands_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def test_no_session_id
138138
}
139139
}.to_json
140140

141-
stub_request(:post, 'http://127.0.0.1:4723/wd/hub/session')
141+
stub_request(:post, 'http://127.0.0.1:4723/session')
142142
.to_return(headers: HEADER, status: 200, body: response)
143143

144144
error = assert_raises ::Selenium::WebDriver::Error::WebDriverError do
@@ -149,12 +149,12 @@ def test_no_session_id
149149
end
150150

151151
def test_remote_status
152-
stub_request(:get, 'http://127.0.0.1:4723/wd/hub/status')
152+
stub_request(:get, 'http://127.0.0.1:4723/status')
153153
.to_return(headers: HEADER, status: 200, body: { value: 'xxxx' }.to_json)
154154

155155
@driver.remote_status
156156

157-
assert_requested(:get, 'http://127.0.0.1:4723/wd/hub/status', times: 1)
157+
assert_requested(:get, 'http://127.0.0.1:4723/status', times: 1)
158158
end
159159

160160
def test_page_source

0 commit comments

Comments
 (0)