summaryrefslogtreecommitdiff
path: root/vendor/github.com/playwright-community/playwright-go/dialog.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/playwright-community/playwright-go/dialog.go')
-rw-r--r--vendor/github.com/playwright-community/playwright-go/dialog.go48
1 files changed, 48 insertions, 0 deletions
diff --git a/vendor/github.com/playwright-community/playwright-go/dialog.go b/vendor/github.com/playwright-community/playwright-go/dialog.go
new file mode 100644
index 0000000..8d13234
--- /dev/null
+++ b/vendor/github.com/playwright-community/playwright-go/dialog.go
@@ -0,0 +1,48 @@
+package playwright
+
+type dialogImpl struct {
+ channelOwner
+ page Page
+}
+
+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 (d *dialogImpl) Page() Page {
+ return d.page
+}
+
+func newDialog(parent *channelOwner, objectType string, guid string, initializer map[string]interface{}) *dialogImpl {
+ bt := &dialogImpl{}
+ bt.createChannelOwner(bt, parent, objectType, guid, initializer)
+ page := fromNullableChannel(initializer["page"])
+ if page != nil {
+ bt.page = page.(*pageImpl)
+ }
+ return bt
+}