Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/functional-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
appium driver install xcuitest
appium plugin install images
appium plugin install execute-driver
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors --base-path=/wd/hub 2>&1 > appium.log &
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors 2>&1 > appium.log &

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
appium driver install xcuitest
appium plugin install images@2.1.8
appium plugin install execute-driver
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors --base-path=/wd/hub > appium.log &
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors > appium.log &

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand Down Expand Up @@ -216,7 +216,7 @@ jobs:
appium driver install ${{matrix.test_targets.automation_name}}
appium plugin install images
appium plugin install execute-driver
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors --base-path=/wd/hub > appium.log &
nohup appium --use-plugins=images,execute-driver --relaxed-security --log-timestamp --log-no-colors > appium.log &

- name: Enable KVM group perms
run: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Read `release_notes.md` for commit level details.
### Bug fixes

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

## [9.5.2] - 2025-01-30
- Fix yardoc
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Run functional tests which require the Appium server and real device, Simulator/
$ npm install --location=global appium
$ appium driver install xcuitest
$ appium driver install uiautomator2 # etc
$ appium --base-path=/wd/hub --relaxed-security # To run all tests in local
$ appium --relaxed-security # To run all tests in local
```

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

```ruby
# @driver is the driver instance of an existing session
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'
attached_driver = ::Appium::Core::Driver.attach_to @driver.session_id, url: 'http://127.0.0.1:4723', automation_name: 'XCUITest', platform_name: 'ios'
assert attached_driver.session_id == @driver.session_id
attached_driver.page_source
```
Expand Down
2 changes: 1 addition & 1 deletion lib/appium_lib_core/common/base/bridge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def browser
#
# new_driver = ::Appium::Core::Driver.attach_to(
# driver.session_id,
# url: 'http://127.0.0.1:4723/wd/hub', automation_name: 'UiAutomator2', platform_name: 'Android'
# url: 'http://127.0.0.1:4723', automation_name: 'UiAutomator2', platform_name: 'Android'
# )
#
def attach_to(session_id, platform_name, automation_name)
Expand Down
24 changes: 12 additions & 12 deletions lib/appium_lib_core/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class Driver
attr_reader :automation_name

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

Expand Down Expand Up @@ -196,7 +196,7 @@ class Driver
# # format 1
# @core = Appium::Core.for caps: {...}, appium_lib: {...}
# # format 2. 'capabilities:' is also available instead of 'caps:'.
# @core = Appium::Core.for url: "http://127.0.0.1:8080/wd/hub", capabilities: {...}, appium_lib: {...}
# @core = Appium::Core.for url: "http://127.0.0.1:8080", capabilities: {...}, appium_lib: {...}
#
#
# require 'rubygems'
Expand All @@ -220,7 +220,7 @@ class Driver
# }
# }
# @core = Appium::Core.for(opts) # create a core driver with 'opts' and extend methods into 'self'
# @core.start_driver # Connect to 'http://127.0.0.1:8080/wd/hub' because of 'port: 8080'
# @core.start_driver # Connect to 'http://127.0.0.1:8080' because of 'port: 8080'
#
# # Start iOS driver with .zip file over HTTP
# # 'capabilities:' is also available instead of 'caps:'. Either is fine.
Expand All @@ -233,19 +233,19 @@ class Driver
# app: 'http://example.com/path/to/MyiOS.app.zip'
# },
# appium_lib: {
# server_url: 'http://custom-host:8080/wd/hub.com',
# server_url: 'http://custom-host:8080/wd/hub',
# wait: 0,
# wait_timeout: 20,
# wait_interval: 0.3,
# listener: nil,
# }
# }
# @core = Appium::Core.for(opts)
# @core.start_driver # Connect to 'http://custom-host:8080/wd/hub.com'
# @core.start_driver # Connect to 'http://custom-host:8080/wd/hub'
#
# # Start iOS driver as another format. 'url' is available like below
# opts = {
# url: "http://custom-host:8080/wd/hub.com",
# url: "http://custom-host:8080/wd/hub",
# capabilities: {
# platformName: :ios,
# platformVersion: '11.0',
Expand All @@ -261,7 +261,7 @@ class Driver
# }
# }
# @core = Appium::Core.for(opts) # create a core driver with 'opts' and extend methods into 'self'
# @core.start_driver # start driver with 'url'. Connect to 'http://custom-host:8080/wd/hub.com'
# @core.start_driver # start driver with 'url'. Connect to 'http://custom-host:8080/wd/hub'
#
# # With a custom listener
# class CustomListener < ::Selenium::WebDriver::Support::AbstractEventListener
Expand Down Expand Up @@ -300,7 +300,7 @@ def self.for(opts = {})
#
# new_driver = ::Appium::Core::Driver.attach_to(
# driver.session_id, # The 'driver' has an existing session id
# url: 'http://127.0.0.1:4723/wd/hub', automation_name: 'UiAutomator2', platform_name: 'Android'
# url: 'http://127.0.0.1:4723', automation_name: 'UiAutomator2', platform_name: 'Android'
# )
# new_driver.page_source # for example
#
Expand Down Expand Up @@ -352,7 +352,7 @@ def setup_for_new_session(opts = {})
# Creates a new global driver and quits the old one if it exists.
# You can customise http_client as the following
#
# @param [String] server_url Custom server url to send to requests. Default is "http://127.0.0.1:4723/wd/hub".
# @param [String] server_url Custom server url to send to requests. Default is "http://127.0.0.1:4723".
# @param http_client_ops [Hash] Options for http client
# @option http_client_ops [Hash] :http_client Custom HTTP Client
# @option http_client_ops [Hash] :open_timeout Custom open timeout for http client.
Expand Down Expand Up @@ -383,18 +383,18 @@ def setup_for_new_session(opts = {})
# }
#
# @core = Appium::Core.for(opts) # create a core driver with 'opts' and extend methods into 'self'
# @driver = @core.start_driver server_url: "http://127.0.0.1:8000/wd/hub"
# @driver = @core.start_driver server_url: "http://127.0.0.1:8000"
#
# # Attach custom HTTP client
# @driver = @core.start_driver server_url: "http://127.0.0.1:8000/wd/hub",
# @driver = @core.start_driver server_url: "http://127.0.0.1:8000",
# http_client_ops: { http_client: Your:Http:Client.new,
# open_timeout: 1_000,
# read_timeout: 1_000 }
#

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

@http_client = get_http_client http_client: http_client_ops.delete(:http_client),
Expand Down
28 changes: 14 additions & 14 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,8 @@ def udid_name

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

def android_mock_create_session
android_mock_create_session_w3c
Expand All @@ -443,7 +443,7 @@ def android_mock_create_session_w3c
}
}.to_json

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

stub_request(:post, "#{SESSION}/timeouts")
Expand All @@ -457,7 +457,7 @@ def android_mock_create_session_w3c
assert_equal({}, driver.send(:bridge).http.additional_headers)
assert_requested(
:post,
'http://127.0.0.1:4723/wd/hub/session',
'http://127.0.0.1:4723/session',
headers: {
'X-Idempotency-Key' => /.+/,
'Content-Type' => 'application/json; charset=UTF-8',
Expand Down Expand Up @@ -500,7 +500,7 @@ def android_chrome_mock_create_session_w3c
}
}.to_json

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

stub_request(:post, "#{SESSION}/timeouts")
Expand All @@ -512,7 +512,7 @@ def android_chrome_mock_create_session_w3c
assert_equal({}, driver.send(:bridge).http.additional_headers)
assert_requested(
:post,
'http://127.0.0.1:4723/wd/hub/session',
'http://127.0.0.1:4723/session',
headers: {
'X-Idempotency-Key' => /.+/,
'Content-Type' => 'application/json; charset=UTF-8',
Expand Down Expand Up @@ -558,14 +558,14 @@ def ios_mock_create_session_w3c
}
}.to_json

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

driver = @core.start_driver

assert_requested(
:post,
'http://127.0.0.1:4723/wd/hub/session',
'http://127.0.0.1:4723/session',
headers: {
'X-Idempotency-Key' => /.+/,
'Content-Type' => 'application/json; charset=UTF-8',
Expand All @@ -589,14 +589,14 @@ def windows_mock_create_session
}
}.to_json

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

driver = @core.start_driver

assert_requested(
:post,
'http://127.0.0.1:4723/wd/hub/session',
'http://127.0.0.1:4723/session',
headers: {
'X-Idempotency-Key' => /.+/,
'Content-Type' => 'application/json; charset=UTF-8',
Expand All @@ -620,14 +620,14 @@ def windows_mock_create_session_w3c
}
}.to_json

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

driver = @core.start_driver

assert_requested(
:post,
'http://127.0.0.1:4723/wd/hub/session',
'http://127.0.0.1:4723/session',
headers: {
'X-Idempotency-Key' => /.+/,
'Content-Type' => 'application/json; charset=UTF-8',
Expand All @@ -649,14 +649,14 @@ def mac2_mock_create_session_w3c
}
}.to_json

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

driver = @core.start_driver

assert_requested(
:post,
'http://127.0.0.1:4723/wd/hub/session',
'http://127.0.0.1:4723/session',
headers: {
'X-Idempotency-Key' => /.+/,
'Content-Type' => 'application/json; charset=UTF-8',
Expand Down
6 changes: 3 additions & 3 deletions test/unit/android/webdriver/w3c/commands_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def test_no_session_id
}
}.to_json

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

error = assert_raises ::Selenium::WebDriver::Error::WebDriverError do
Expand All @@ -149,12 +149,12 @@ def test_no_session_id
end

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

@driver.remote_status

assert_requested(:get, 'http://127.0.0.1:4723/wd/hub/status', times: 1)
assert_requested(:get, 'http://127.0.0.1:4723/status', times: 1)
end

def test_page_source
Expand Down
Loading
Loading