Skip to content

Commit c7dfaa5

Browse files
committed
dns error is special for the new chromium version
1 parent 809a341 commit c7dfaa5

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

page.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,8 @@ func (p *Page) Navigate(url string) error {
158158
url = "about:blank"
159159
}
160160

161-
err := p.StopLoading()
162-
if err != nil {
163-
return err
164-
}
161+
// try to stop loading
162+
_ = p.StopLoading()
165163

166164
res, err := proto.PageNavigate{URL: url}.Call(p)
167165
if err != nil {

page_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -670,13 +670,19 @@ func TestPagePDF(t *testing.T) {
670670
})
671671
}
672672

673-
func TestPageNavigateErr(t *testing.T) {
673+
func TestPageNavigateDNSErr(t *testing.T) {
674674
g := setup(t)
675+
p := g.newPage()
675676

676677
// dns error
677-
err := g.page.Navigate("http://" + g.RandStr(16))
678+
err := p.Navigate("http://" + g.RandStr(16))
678679
g.Is(err, &rod.ErrNavigation{})
679680
g.Is(err.Error(), "navigation failed: net::ERR_NAME_NOT_RESOLVED")
681+
p.MustNavigate("about:blank")
682+
}
683+
684+
func TestPageNavigateErr(t *testing.T) {
685+
g := setup(t)
680686

681687
s := g.Serve()
682688

@@ -691,10 +697,6 @@ func TestPageNavigateErr(t *testing.T) {
691697
g.page.MustNavigate(s.URL("/404"))
692698
g.page.MustNavigate(s.URL("/500"))
693699

694-
g.Panic(func() {
695-
g.mc.stubErr(1, proto.PageStopLoading{})
696-
g.page.MustNavigate(g.blank())
697-
})
698700
g.Panic(func() {
699701
g.mc.stubErr(1, proto.PageNavigate{})
700702
g.page.MustNavigate(g.blank())

0 commit comments

Comments
 (0)