class Superbot::Cloud::CLI::Webdriver::CreateCommand
Public Instance Methods
create_webdriver()
click to toggle source
# 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.authorization_header, '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
execute()
click to toggle source
# File lib/superbot/cloud/cli/webdriver/create_command.rb, line 11 def execute create_webdriver end