forked from playwright-community/playwright-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
frame_locator.go
32 lines (24 loc) · 1 KB
/
frame_locator.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package playwright
import "strconv"
type frameLocatorImpl struct {
frame *frameImpl
frameSelector string
}
func newFrameLocator(frame *frameImpl, frameSelector string) *frameLocatorImpl {
return &frameLocatorImpl{frame: frame, frameSelector: frameSelector}
}
func (fl *frameLocatorImpl) First() FrameLocator {
return newFrameLocator(fl.frame, fl.frameSelector+" >> nth=0")
}
func (fl *frameLocatorImpl) FrameLocator(selector string) FrameLocator {
return newFrameLocator(fl.frame, fl.frameSelector+" >> control=enter-frame >> "+selector)
}
func (fl *frameLocatorImpl) Last() FrameLocator {
return newFrameLocator(fl.frame, fl.frameSelector+" >> nth=-1")
}
func (fl *frameLocatorImpl) Locator(selector string, options ...LocatorLocatorOptions) (Locator, error) {
return newLocator(fl.frame, fl.frameSelector+" >> control=enter-frame >> "+selector, options...)
}
func (fl *frameLocatorImpl) Nth(index int) FrameLocator {
return newFrameLocator(fl.frame, fl.frameSelector+" >> nth="+strconv.Itoa(index))
}