Module: IframeStepsHelper
- Defined in:
- lib/spreewald/frame_steps.rb
Instance Method Summary collapse
Instance Method Details
#convert_frame_identifier(frame_identifier) ⇒ Object
67 68 69 70 71 72 73 74 75 |
# File 'lib/spreewald/frame_steps.rb', line 67 def convert_frame_identifier(frame_identifier) number_regex = /\A(?<number>\d+)(st|nd|rd|th|\.)\z/ matches = frame_identifier.match(number_regex) if matches && matches[:number] matches[:number].to_i - 1 # selenium starts counting a 0 else frame_identifier end end |
#find_frame(frame_identifier) ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/spreewald/frame_steps.rb', line 56 def find_frame(frame_identifier) frame_id = convert_frame_identifier(frame_identifier) case frame_id when Integer frames = page.find_all('iframe') frames[frame_id] when String page.find("iframe[name='#{frame_id}']") end end |