Skip to content

Commit bcf57c8

Browse files
committed
issue#198 add readme example for frame method of node
1 parent f072bb9 commit bcf57c8

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -848,17 +848,6 @@ browser.frames # =>
848848
# ]
849849
```
850850

851-
### frame: `Frame | nil`
852-
853-
Return the frame object within parent element use [frame](https://github.com/rubycdp/ferrum#frame-1) method.
854-
855-
```ruby
856-
frame = p.at_css('iframe').frame # => #<Ferrum::Frame >,
857-
858-
# You can use finder method on frame object as a normal element.
859-
frame.at_css("body").text
860-
```
861-
862851
#### main_frame : `Frame`
863852

864853
Returns page's main frame, the top of the tree and the parent of all frames.
@@ -1040,6 +1029,20 @@ browser.playback_rate # => 2000
10401029
#### node? : `Boolean`
10411030
#### frame_id
10421031
#### frame
1032+
1033+
Returns the [frame](https://github.com/rubycdp/ferrum#frame) object within parent node:
1034+
1035+
```ruby
1036+
div = browser.at_css("div.has-frame")
1037+
div.at_css("iframe").frame # => Frame
1038+
```
1039+
1040+
You can keep using [Finders](https://github.com/rubycdp/ferrum#Finders) within that frame object:
1041+
1042+
```ruby
1043+
browser.at_css("div.has-frame").frame.at_css("body") # => Node
1044+
```
1045+
10431046
#### focus
10441047
#### focusable?
10451048
#### moving? : `Boolean`

0 commit comments

Comments
 (0)