diff --git a/.travis.yml b/.travis.yml index 0c840f4..82154cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,10 +6,6 @@ go: addons: apt: chrome: stable - sources: - - ubuntu-toolchain-r-test - packages: - - libstdc++6 before_install: - go get github.com/mattn/goveralls script: diff --git a/LICENSE b/LICENSE index 8e2e6c2..09ca771 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016-2017 Kenneth Shaw +Copyright (c) 2016-2018 Kenneth Shaw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/nav_test.go b/nav_test.go index b144fb2..325a75f 100644 --- a/nav_test.go +++ b/nav_test.go @@ -111,7 +111,7 @@ func TestNavigateToHistoryEntry(t *testing.T) { var entries []*page.NavigationEntry var index int64 - err = c.Run(defaultContext, Navigate(testdataDir+"/"+"image.html")) + err = c.Run(defaultContext, Navigate(testdataDir+"/image.html")) if err != nil { t.Fatal(err) } @@ -123,7 +123,7 @@ func TestNavigateToHistoryEntry(t *testing.T) { t.Fatal(err) } - err = c.Run(defaultContext, Navigate(testdataDir+"/"+"form.html")) + err = c.Run(defaultContext, Navigate(testdataDir+"/form.html")) if err != nil { t.Fatal(err) } @@ -155,7 +155,7 @@ func TestNavigateBack(t *testing.T) { c := testAllocate(t, "") defer c.Release() - err = c.Run(defaultContext, Navigate(testdataDir+"/"+"form.html")) + err = c.Run(defaultContext, Navigate(testdataDir+"/form.html")) if err != nil { t.Fatal(err) } @@ -168,7 +168,7 @@ func TestNavigateBack(t *testing.T) { t.Fatal(err) } - err = c.Run(defaultContext, Navigate(testdataDir+"/"+"image.html")) + err = c.Run(defaultContext, Navigate(testdataDir+"/image.html")) if err != nil { t.Fatal(err) } @@ -200,14 +200,14 @@ func TestNavigateForward(t *testing.T) { c := testAllocate(t, "") defer c.Release() - err = c.Run(defaultContext, Navigate(testdataDir+"/"+"form.html")) + err = c.Run(defaultContext, Navigate(testdataDir+"/form.html")) if err != nil { t.Fatal(err) } time.Sleep(50 * time.Millisecond) - err = c.Run(defaultContext, Navigate(testdataDir+"/"+"image.html")) + err = c.Run(defaultContext, Navigate(testdataDir+"/image.html")) if err != nil { t.Fatal(err) } @@ -252,7 +252,7 @@ func TestStop(t *testing.T) { c := testAllocate(t, "") defer c.Release() - err = c.Run(defaultContext, Navigate(testdataDir+"/"+"form.html")) + err = c.Run(defaultContext, Navigate(testdataDir+"/form.html")) if err != nil { t.Fatal(err) } @@ -271,7 +271,7 @@ func TestReload(t *testing.T) { c := testAllocate(t, "") defer c.Release() - err = c.Run(defaultContext, Navigate(testdataDir+"/"+"form.html")) + err = c.Run(defaultContext, Navigate(testdataDir+"/form.html")) if err != nil { t.Fatal(err) } @@ -309,7 +309,7 @@ func TestCaptureScreenshot(t *testing.T) { c := testAllocate(t, "") defer c.Release() - err = c.Run(defaultContext, Navigate(testdataDir+"/"+"image.html")) + err = c.Run(defaultContext, Navigate(testdataDir+"/image.html")) if err != nil { t.Fatal(err) } @@ -342,7 +342,7 @@ func TestCaptureScreenshot(t *testing.T) { t.Fatal(err) } - err = c.Run(defaultContext, Navigate(testdataDir+"/"+"form.html")) + err = c.Run(defaultContext, Navigate(testdataDir+"/form.html")) if err != nil { t.Fatal(err) } @@ -378,7 +378,7 @@ func TestRemoveOnLoadScript(t *testing.T) { t.Fatal(err) } - err = c.Run(defaultContext, Navigate(testdataDir+"/"+"form.html")) + err = c.Run(defaultContext, Navigate(testdataDir+"/form.html")) if err != nil { t.Fatal(err) } @@ -390,7 +390,7 @@ func TestLocation(t *testing.T) { t.Parallel() var err error - expurl := testdataDir + "/" + "form.html" + expurl := testdataDir + "/form.html" c := testAllocate(t, "") defer c.Release() @@ -409,7 +409,7 @@ func TestLocation(t *testing.T) { } if urlstr != expurl { - t.Fatalf("expected to be on form.html,got: %s", urlstr) + t.Fatalf("expected to be on form.html, got: %s", urlstr) } } diff --git a/query.go b/query.go index f49744e..c2b51e6 100644 --- a/query.go +++ b/query.go @@ -11,11 +11,12 @@ import ( "strings" "sync" + "github.com/disintegration/imaging" + "github.com/chromedp/cdproto/cdp" "github.com/chromedp/cdproto/css" "github.com/chromedp/cdproto/dom" "github.com/chromedp/cdproto/page" - "github.com/disintegration/imaging" ) // Nodes retrieves the document nodes matching the selector. @@ -475,7 +476,7 @@ func Screenshot(sel interface{}, picbuf *[]byte, opts ...QueryOption) Action { return err } - // crop to box model contents. + // crop to box model contents cropped := imaging.Crop(img, image.Rect( int(box.Margin[0])-pos[0], int(box.Margin[1])-pos[1], int(box.Margin[4])-pos[0], int(box.Margin[5])-pos[1], diff --git a/query_test.go b/query_test.go index bf52e69..03fc73e 100644 --- a/query_test.go +++ b/query_test.go @@ -805,7 +805,7 @@ func TestSubmit(t *testing.T) { t.Fatalf("got error: %v", err) } if title != "this is title" { - t.Errorf("expected title to be 'chromedp - Google Search', got: '%s'", title) + t.Errorf("expected title to be 'this is title', got: '%s'", title) } }) } diff --git a/sel_test.go b/sel_test.go index 3795a49..de95153 100644 --- a/sel_test.go +++ b/sel_test.go @@ -31,7 +31,6 @@ func TestWaitReady(t *testing.T) { if err != nil { t.Fatalf("got error: %v", err) } - } func TestWaitVisible(t *testing.T) { @@ -59,7 +58,6 @@ func TestWaitVisible(t *testing.T) { if err != nil { t.Fatalf("got error: %v", err) } - } func TestWaitNotVisible(t *testing.T) { @@ -92,7 +90,6 @@ func TestWaitNotVisible(t *testing.T) { if err != nil { t.Fatalf("got error: %v", err) } - } func TestWaitEnabled(t *testing.T) { @@ -141,7 +138,6 @@ func TestWaitEnabled(t *testing.T) { if value != "foo" { t.Fatalf("expected value to be foo, got: %s", value) } - } func TestWaitSelected(t *testing.T) {