forked from playwright-community/playwright-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dialog.go
39 lines (32 loc) · 895 Bytes
/
dialog.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
33
34
35
36
37
38
39
package playwright
type dialogImpl struct {
channelOwner
}
func (d *dialogImpl) Type() string {
return d.initializer["type"].(string)
}
func (d *dialogImpl) Message() string {
return d.initializer["message"].(string)
}
func (d *dialogImpl) DefaultValue() string {
return d.initializer["defaultValue"].(string)
}
func (d *dialogImpl) Accept(promptTextInput ...string) error {
var promptText *string
if len(promptTextInput) == 1 {
promptText = &promptTextInput[0]
}
_, err := d.channel.Send("accept", map[string]interface{}{
"promptText": promptText,
})
return err
}
func (d *dialogImpl) Dismiss() error {
_, err := d.channel.Send("dismiss")
return err
}
func newDialog(parent *channelOwner, objectType string, guid string, initializer map[string]interface{}) *dialogImpl {
bt := &dialogImpl{}
bt.createChannelOwner(bt, parent, objectType, guid, initializer)
return bt
}