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



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

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

#check_radiobutton(checkbox_name, index = 0) ⇒ Object



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

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

#click_by_xpath(xpath) ⇒ Object



71
72
73
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 71

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

#click_image_map(index = 0) ⇒ Object



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

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

Click the link specified by the text



63
64
65
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 63

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


67
68
69
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 67

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



52
53
54
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 52

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

#fill_textarea(textarea_name, text) ⇒ Object

Action to fill a textarea with text



32
33
34
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 32

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

#fill_textfield(textfield_name, query_string) ⇒ 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)
  FetchAction.fill_textfield(textfield_name, query_string)
end

#select_option(selectlist_name, option) ⇒ Object

Action for selecting an option from a dropdown box



38
39
40
# File 'lib/scrubyt/core/navigation/navigation_actions.rb', line 38

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

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

Submit the current form



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

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

#wait(time = 1) ⇒ Object



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

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