Module: Selenium::Client::Base
Overview
Driver constructor and session management commands
Original code by Aslak Hellesoy and Darren Hobbs
Instance Attribute Summary collapse
Attributes included from Protocol
#session_id
Instance Method Summary
collapse
Methods included from Idiomatic
#alert, #alert?, #body_text, #checked?, #click, #confirmation, #confirmation?, #cookie, #cookie?, #cookies, #create_cookie, #delete_cookie, #element?, #field, #go_back, #js_eval, #location, #prompt, #prompt?, #remote_control_timeout_in_seconds=, #table_cell_text, #text?, #text_content, #title, #value, #wait_for, #wait_for_condition, #wait_for_page
Methods included from Extensions
#wait_for_ajax, #wait_for_effects, #wait_for_element, #wait_for_field_value, #wait_for_no_element, #wait_for_no_text, #wait_for_text
#add_location_strategy, #add_selection, #allow_native_xpath, #alt_key_down, #alt_key_up, #answer_on_next_prompt, #assign_id, #attach_file, #capture_entire_page_screenshot, #capture_entire_page_screenshot_to_string, #capture_screenshot, #capture_screenshot_to_string, #check, #choose_cancel_on_next_confirmation, #choose_ok_on_next_confirmation, #click, #click_at, #close, #context_menu, #context_menu_at, #control_key_down, #control_key_up, #create_cookie, #delete_all_visible_cookies, #delete_cookie, #double_click, #double_click_at, #drag_and_drop, #drag_and_drop_to_object, #dragdrop, #fire_event, #focus, #get_alert, #get_all_buttons, #get_all_fields, #get_all_links, #get_all_window_ids, #get_all_window_names, #get_all_window_titles, #get_attribute, #get_attribute_from_all_windows, #get_body_text, #get_confirmation, #get_cookie, #get_cookie_by_name, #get_cursor_position, #get_element_height, #get_element_index, #get_element_position_left, #get_element_position_top, #get_element_width, #get_eval, #get_expression, #get_html_source, #get_location, #get_mouse_speed, #get_prompt, #get_select_options, #get_selected_id, #get_selected_ids, #get_selected_index, #get_selected_indexes, #get_selected_label, #get_selected_labels, #get_selected_value, #get_selected_values, #get_speed, #get_table, #get_text, #get_title, #get_value, #get_whether_this_frame_match_frame_expression, #get_whether_this_window_match_window_expression, #get_xpath_count, #go_back, #highlight, #ignore_attributes_without_value, #is_alert_present, #is_checked, #is_confirmation_present, #is_cookie_present, #is_editable, #is_element_present, #is_ordered, #is_prompt_present, #is_something_selected, #is_text_present, #is_visible, #key_down, #key_down_native, #key_press, #key_press_native, #key_up, #key_up_native, #meta_key_down, #meta_key_up, #mouse_down, #mouse_down_at, #mouse_down_right, #mouse_down_right_at, #mouse_move, #mouse_move_at, #mouse_out, #mouse_over, #mouse_up, #mouse_up_at, #mouse_up_right, #mouse_up_right_at, #open, #open_window, #refresh, #remove_all_selections, #remove_selection, #retrieve_last_remote_control_logs, #rollup, #run_script, #select, #select_frame, #select_window, #set_browser_log_level, #set_context, #set_cursor_position, #set_mouse_speed, #set_speed, #set_timeout, #shift_key_down, #shift_key_up, #shut_down_selenium_server, #submit, #type, #type_keys, #uncheck, #wait_for_condition, #wait_for_frame_to_load, #wait_for_page_to_load, #wait_for_pop_up, #window_focus, #window_maximize
Methods included from Protocol
#boolean_array_command, #boolean_command, #default_timeout_in_seconds, #number_array_command, #number_command, #remote_control_command, #string_array_command, #string_command
Instance Attribute Details
#browser_string ⇒ Object
Returns the value of attribute browser_string.
13
14
15
|
# File 'lib/selenium/client/base.rb', line 13
def browser_string
@browser_string
end
|
Instance Method Details
#chrome_backend? ⇒ Boolean
50
51
52
|
# File 'lib/selenium/client/base.rb', line 50
def chrome_backend?
["*chrome", "*firefox", "*firefox2", "*firefox3"].include?(@browser_string)
end
|
#close_current_browser_session ⇒ Object
37
38
39
40
|
# File 'lib/selenium/client/base.rb', line 37
def close_current_browser_session
remote_control_command "testComplete" if @session_id
@session_id = nil
end
|
#initialize(server_host, server_port, browser_string, browser_url, timeout_in_seconds = 300) ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'lib/selenium/client/base.rb', line 15
def initialize(server_host, server_port, browser_string, browser_url, timeout_in_seconds=300)
@server_host = server_host
@server_port = server_port
@browser_string = browser_string
@browser_url = browser_url
@timeout = timeout_in_seconds
@extension_js = ""
@session_id = nil
end
|
#javascript_extension=(new_javascript_extension) ⇒ Object
54
55
56
|
# File 'lib/selenium/client/base.rb', line 54
def javascript_extension=(new_javascript_extension)
@extension_js = new_javascript_extension
end
|
#session_started? ⇒ Boolean
25
26
27
|
# File 'lib/selenium/client/base.rb', line 25
def session_started?
not @session_id.nil?
end
|
#set_extension_js(new_javascript_extension) ⇒ Object
58
59
60
|
# File 'lib/selenium/client/base.rb', line 58
def set_extension_js(new_javascript_extension)
javascript_extension = new_javascript_extension
end
|
#start ⇒ Object
42
43
44
|
# File 'lib/selenium/client/base.rb', line 42
def start
start_new_browser_session
end
|
#start_new_browser_session ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/selenium/client/base.rb', line 29
def start_new_browser_session
result = string_command "getNewBrowserSession", [@browser_string, @browser_url, @extension_js]
@session_id = result
self.remote_control_timeout_in_seconds = @timeout
end
|
#stop ⇒ Object
46
47
48
|
# File 'lib/selenium/client/base.rb', line 46
def stop
close_current_browser_session
end
|