summaryrefslogtreecommitdiff
path: root/vendor/github.com/playwright-community/playwright-go/console_message.go
blob: 4baf3f18411835ff3525e512b973fd9310e2ab81 (plain)
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
40
41
42
43
44
45
46
47
package playwright

type consoleMessageImpl struct {
	event map[string]interface{}
	page  Page
}

func (c *consoleMessageImpl) Type() string {
	return c.event["type"].(string)
}

func (c *consoleMessageImpl) Text() string {
	return c.event["text"].(string)
}

func (c *consoleMessageImpl) String() string {
	return c.Text()
}

func (c *consoleMessageImpl) Args() []JSHandle {
	args := c.event["args"].([]interface{})
	out := []JSHandle{}
	for idx := range args {
		out = append(out, fromChannel(args[idx]).(*jsHandleImpl))
	}
	return out
}

func (c *consoleMessageImpl) Location() *ConsoleMessageLocation {
	location := &ConsoleMessageLocation{}
	remapMapToStruct(c.event["location"], location)
	return location
}

func (c *consoleMessageImpl) Page() Page {
	return c.page
}

func newConsoleMessage(event map[string]interface{}) *consoleMessageImpl {
	bt := &consoleMessageImpl{}
	bt.event = event
	page := fromNullableChannel(event["page"])
	if page != nil {
		bt.page = page.(*pageImpl)
	}
	return bt
}