forked from playwright-community/playwright-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
console_message.go
45 lines (37 loc) · 1.17 KB
/
console_message.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
40
41
42
43
44
45
package playwright
type consoleMessageImpl struct {
channelOwner
}
// ConsoleMessageLocation represents where a console message was logged in the browser
type ConsoleMessageLocation struct {
URL string `json:"url"`
LineNumber int `json:"lineNumber"`
ColumnNumber int `json:"columnNumber"`
}
func (c *consoleMessageImpl) Type() string {
return c.initializer["type"].(string)
}
func (c *consoleMessageImpl) Text() string {
return c.initializer["text"].(string)
}
func (c *consoleMessageImpl) String() string {
return c.Text()
}
func (c *consoleMessageImpl) Args() []JSHandle {
args := c.initializer["args"].([]interface{})
out := []JSHandle{}
for idx := range args {
out = append(out, fromChannel(args[idx]).(*jsHandleImpl))
}
return out
}
func (c *consoleMessageImpl) Location() ConsoleMessageLocation {
locations := ConsoleMessageLocation{}
remapMapToStruct(c.initializer["location"], &locations)
return locations
}
func newConsoleMessage(parent *channelOwner, objectType string, guid string, initializer map[string]interface{}) *consoleMessageImpl {
bt := &consoleMessageImpl{}
bt.createChannelOwner(bt, parent, objectType, guid, initializer)
return bt
}