Skip to content

Commit

Permalink
use element to get the window obj
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmood committed Mar 3, 2022
1 parent 2f74c32 commit 82ff894
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
9 changes: 2 additions & 7 deletions page_eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,17 +354,12 @@ func (p *Page) getJSCtxID() (proto.RuntimeRemoteObjectID, error) {
return *p.jsCtxID, nil
}

owner, err := proto.DOMGetFrameOwner{FrameID: p.FrameID}.Call(p)
node, err := p.element.Describe(1, true)
if err != nil {
return "", err
}

node, err := proto.DOMDescribeNode{BackendNodeID: owner.BackendNodeID, Pierce: true}.Call(p)
if err != nil {
return "", err
}

obj, err := proto.DOMResolveNode{BackendNodeID: node.Node.ContentDocument.BackendNodeID}.Call(p)
obj, err := proto.DOMResolveNode{BackendNodeID: node.ContentDocument.BackendNodeID}.Call(p)
if err != nil {
return "", err
}
Expand Down
3 changes: 0 additions & 3 deletions page_eval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ func (t T) PageUpdateJSCtxIDErr() {

frame := page.MustElement("iframe").MustFrame()

t.mc.stubErr(1, proto.DOMGetFrameOwner{})
t.Err(frame.Element(`button`))

frame.MustReload()
t.mc.stubErr(1, proto.DOMDescribeNode{})
t.Err(frame.Element(`button`))
Expand Down

0 comments on commit 82ff894

Please sign in to comment.