Class: WebDriverScriptAdapter::FrameAdapter::CapybaraAdapter
- Inherits:
-
DumbDelegator
- Object
- DumbDelegator
- WebDriverScriptAdapter::FrameAdapter::CapybaraAdapter
- Defined in:
- lib/webdriver_script_adapter/frame_adapter.rb
Instance Method Summary collapse
- #find_frames ⇒ Object
-
#initialize(driver) ⇒ CapybaraAdapter
constructor
A new instance of CapybaraAdapter.
- #within_frame(frame) ⇒ Object
Constructor Details
#initialize(driver) ⇒ CapybaraAdapter
Returns a new instance of CapybaraAdapter.
60 61 62 63 |
# File 'lib/webdriver_script_adapter/frame_adapter.rb', line 60 def initialize(driver) super(driver) @driver = driver end |
Instance Method Details
#find_frames ⇒ Object
88 89 90 |
# File 'lib/webdriver_script_adapter/frame_adapter.rb', line 88 def find_frames find_css("iframe") end |
#within_frame(frame) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/webdriver_script_adapter/frame_adapter.rb', line 65 def within_frame(frame) # Patch the `Symbol` class to respond to the :native method. # Will be fixed in https://github.com/teamcapybara/capybara/pull/2462 (:parent).class.define_method(:native) do nil end switch_to_frame frame yield ensure begin switch_to_frame :parent rescue => e if /switchToParentFrame|frame\/parent/.match(e.) ::Kernel.warn "WARNING: This browser only supports first-level iframes. Second-level iframes and beyond will not be audited. To skip auditing all iframes, set Axe::Configuration#skip_iframes=true" end switch_to_frame :top end end |