15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/superbot/cloud/cli/webdriver/create_command.rb', line 15
def create_webdriver
request_body = {
organization_name: organization,
desiredCapabilities: {
browserName: 'chrome',
superOptions: {}
}
}
request_body[:desiredCapabilities][:superOptions][:region] = region if region
puts "Creating a webdriver session..."
puts "Please wait for Session ID or press [ctrl/cmd + c] to exit"
session = Excon.post(
[Superbot.webdriver_endpoint(local? ? 'local_cloud' : 'cloud'), 'wd/hub/session'].join('/'),
persistent: true,
headers: { 'Authorization' => Superbot::Cloud., 'Content-Type' => 'application/json' },
body: request_body.to_json,
connect_timeout: 3,
read_timeout: 500,
write_timeout: 500
)
parsed_response = JSON.parse(session.body)
puts parsed_response['error'] || parsed_response['sessionId']
end
|