Skip to content

Commit b3900f7

Browse files
committed
add docstring
1 parent d97e743 commit b3900f7

1 file changed

Lines changed: 22 additions & 7 deletions

File tree

lib/appium_lib_core/common/base/driver.rb

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,6 @@ def create_bridge(**opts)
101101

102102
public
103103

104-
def bidi
105-
return @bridge.bidi if @has_bidi
106-
107-
msg = 'BiDi must be enabled by providing webSocketUrl capability to true'
108-
raise(::Selenium::WebDriver::Error::WebDriverError, msg)
109-
end
110-
111104
# Update +server_url+ and HTTP clients following this arguments, protocol, host, port and path.
112105
# After this method, +@bridge.http+ will be a new instance following them instead of +server_url+ which is
113106
# set before creating session.
@@ -1011,6 +1004,28 @@ def execute_driver(script: '', type: 'webdriverio', timeout_ms: nil)
10111004
def convert_to_element(response_id)
10121005
@bridge.convert_to_element response_id
10131006
end
1007+
1008+
# Return bidi instance
1009+
# @return [::Selenium::WebDriver::BiDi]
1010+
#
1011+
# @example
1012+
#
1013+
# log_entries = []
1014+
# driver.bidi.send_cmd('session.subscribe', 'events': ['log.entryAdded'], 'contexts': ['NATIVE_APP'])
1015+
# subscribe_id = driver.bidi.add_callback('log.entryAdded') do |params|
1016+
# log_entries << params
1017+
# end
1018+
# driver.page_source
1019+
#
1020+
# driver.bidi.remove_callback('log.entryAdded', subscribe_id)
1021+
# driver.bidi.send_cmd('session.unsubscribe', 'events': ['log.entryAdded'], 'contexts': ['NATIVE_APP'])
1022+
#
1023+
def bidi
1024+
return @bridge.bidi if @has_bidi
1025+
1026+
msg = 'BiDi must be enabled by providing webSocketUrl capability to true'
1027+
raise(::Selenium::WebDriver::Error::WebDriverError, msg)
1028+
end
10141029
end # class Driver
10151030
end # class Base
10161031
end # module Core

0 commit comments

Comments
 (0)