Module: Scrubyt::NavigationActions

Defined in:
lib/scrubyt/core/navigation/navigation_actions.rb

Overview

Describing actions which interact with the page

This class contains all the actions that are used to navigate on web pages; first of all, fetch for downloading the pages - then various actions like filling textfields, submitting formst, clicking links and more

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extend_object(obj) ⇒ Object



10
11
12
13
14
15
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 10

def self.extend_object(obj)
  super(obj)
  obj.instance_eval do
    @current_form = nil
  end
end

Instance Method Details

#check_checkbox(checkbox_name) ⇒ Object



46
47
48
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 46

def check_checkbox(checkbox_name)
  FetchAction.check_checkbox(checkbox_name)
end

#check_radiobutton(checkbox_name, index = 0) ⇒ Object



50
51
52
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 50

def check_radiobutton(checkbox_name, index=0)
  FetchAction.check_radiobutton(checkbox_name, index=0)
end

#click_by_xpath(xpath) ⇒ Object



87
88
89
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 87

def click_by_xpath(xpath)
  FetchAction.click_by_xpath(xpath)
end

#click_by_xpath_and_wait(xpath, secs) ⇒ Object



91
92
93
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 91

def click_by_xpath_and_wait(xpath, secs)
  FetchAction.click_by_xpath(xpath, secs)
end

#click_by_xpath_if_exists(xpath, sleep_secs = 0) ⇒ Object



83
84
85
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 83

def click_by_xpath_if_exists(xpath, sleep_secs=0)
  FetchAction.click_by_xpath_if_exists(xpath, sleep_secs)
end

#click_image_map(index = 0) ⇒ Object



95
96
97
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 95

def click_image_map(index=0)
  FetchAction.click_image_map(index)
end

Click the link specified by the text



75
76
77
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 75

def click_link(link_spec,index=0)
  FetchAction.click_link(link_spec,index, 0)
end


79
80
81
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 79

def click_link_and_wait(link_spec, sleep_secs=0)
  FetchAction.click_link(link_spec, 0, sleep_secs)      
end

#fetch(*args) ⇒ Object

Fetch the document



56
57
58
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 56

def fetch(*args)
  FetchAction.fetch(*args)
end

#fill_textarea(textarea_name, text) ⇒ Object

Action to fill a textarea with text



36
37
38
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 36

def fill_textarea(textarea_name, text)
  FetchAction.fill_textarea(textarea_name, text)
end

#fill_textfield(textfield_name, query_string, use_value = nil) ⇒ Object

Action to fill a textfield with a query string

parameters

textfield_name - the name of the textfield (e.g. the name of the google search textfield is ‘q’

query_string - the string that should be entered into the textfield



26
27
28
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 26

def fill_textfield(textfield_name, query_string, use_value = nil)
  FetchAction.fill_textfield(textfield_name, query_string, 0, use_value)
end

#fill_textfield_and_wait(textfield_name, query_string, sleep_secs = 0, use_value = nil) ⇒ Object



30
31
32
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 30

def fill_textfield_and_wait(textfield_name, query_string, sleep_secs=0, use_value=nil)
  FetchAction.fill_textfield(textfield_name, query_string, sleep_secs, use_value)
end

#frame(attribute, value) ⇒ Object



99
100
101
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 99

def frame(attribute,value)
  FetchAction.frame(attribute,value)
end

#select_option(selectlist_name, option) ⇒ Object

Action for selecting an option from a dropdown box



42
43
44
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 42

def select_option(selectlist_name, option)
  FetchAction.select_option(selectlist_name, option)
end

#submit(index = nil, type = nil) ⇒ Object

Submit the current form



65
66
67
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 65

def submit(index=nil, type=nil)
  FetchAction.submit(index, nil, type)
end

#submit_and_wait(sleep_time, index = nil, type = nil) ⇒ Object



69
70
71
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 69

def submit_and_wait(sleep_time, index=nil, type=nil)
  FetchAction.submit(index, sleep_time,  type)
end

#use_current_pageObject



60
61
62
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 60

def use_current_page
  FetchAction.use_current_page
end

#wait(time = 1) ⇒ Object



103
104
105
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 103

def wait(time=1)
  FetchAction.wait(time)
end