Method: Ferrum::Context#windows
- Defined in:
- lib/ferrum/context.rb
#windows(pos = nil, size = 1) ⇒ Object
When we call ‘page` method on target it triggers ruby to connect to given page by WebSocket, if there are many opened windows but we need only one it makes more sense to get and connect to the needed one only which usually is the last one.
33 34 35 36 37 38 |
# File 'lib/ferrum/context.rb', line 33 def windows(pos = nil, size = 1) raise ArgumentError if pos && !POSITION.include?(pos) windows = @targets.values.select(&:window?) windows = windows.send(pos, size) if pos windows.map(&:page) end |