diff --git a/Taskfile.yml b/Taskfile.yml index 55b8b15..e9710ac 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -26,20 +26,21 @@ tasks: - echo "***Creating Database***" - go clean -modcache - go test ./test/db_test.go -v -rod="show,trace" - manager: - cmds: - - echo "***Connecting to Rod Container using launcher.Manager***" - - go clean -modcache - - docker run -p 7317:7317 ghcr.io/go-rod/rod - # - go run ./manager.go - remote: - cmds: - - echo "***Connecting to Rod Container using launcher.Manager***" - - go clean -modcache - - go run ./remote.go -v -rod="show,trace" test: cmds: - echo "***Running All Tests***" - go clean -modcache - cd /test - go test -v + + # manager: + # cmds: + # - echo "***Connecting to Rod Container using launcher.Manager***" + # - go clean -modcache + # - docker run -p 7317:7317 ghcr.io/go-rod/rod + # # - go run ./manager.go + # remote: + # cmds: + # - echo "***Connecting to Rod Container using launcher.Manager***" + # - go clean -modcache + # - go run ./remote.go -v -rod="show,trace" \ No newline at end of file diff --git a/manager.go b/manager.go deleted file mode 100644 index 223c0f8..0000000 --- a/manager.go +++ /dev/null @@ -1,47 +0,0 @@ -// A server to help launch browser remotely -package main - -import ( - "flag" - "fmt" - "github.com/go-rod/rod/lib/launcher" - "github.com/go-rod/rod/lib/utils" - "log" - "net" - "net/http" - "os" - "gosandbox/core" -) - -var addr = flag.String("address", "localhost:7317", "the address to listen to") -var quiet = flag.Bool("quiet", false, "silence the log") -var allowAllPath = flag.Bool("allow-all", false, "allow all path set by the client") - -func main() { - flag.Parse() - - m := launcher.NewManager() - - if !*quiet { - m.Logger = log.New(os.Stdout, "", 0) - } - - if *allowAllPath { - m.BeforeLaunch = func(l *launcher.Launcher, rw http.ResponseWriter, r *http.Request) {} - } - - l, err := net.Listen("tcp", *addr) - if err != nil { - utils.E(err) - } - - if !*quiet { - fmt.Println("rod-manager listening on:", l.Addr().String()) - } - - srv := &http.Server{Handler: m} - utils.E(srv.Serve(l)) - - core.Remote() - -} diff --git a/remote.go b/remote.go deleted file mode 100644 index 0a85e5c..0000000 --- a/remote.go +++ /dev/null @@ -1,39 +0,0 @@ -// Package main ... -package main - -import ( - "fmt" - - "github.com/go-rod/rod" - "github.com/go-rod/rod/lib/launcher" - "github.com/go-rod/rod/lib/utils" -) - -func main() { - // This example is to launch a browser remotely, not connect to a running browser remotely, - // to connect to a running browser check the "../connect-browser" example. - // Rod provides a docker image for beginers, run the below to start a launcher.Manager: - // - // docker run -p 7317:7317 ghcr.io/go-rod/rod - // - // For more information, check the doc of launcher.Manager - l := launcher.MustNewManaged("") - - // You can also set any flag remotely before you launch the remote browser. - // Available flags: https://peter.sh/experiments/chromium-command-line-switches - l.Set("disable-gpu").Delete("disable-gpu") - - // Launch with headful mode - // l.Headless(false).XVFB("--server-num=5", "--server-args=-screen 0 1600x900x16") - - browser := rod.New().Client(l.MustClient()).MustConnect() - - // You may want to start a server to watch the screenshots of the remote browser. - launcher.Open(browser.ServeMonitor("")) - - fmt.Println( - browser.MustPage("https://mdn.dev/").MustEval("() => document.title"), - ) - - utils.Pause() -} \ No newline at end of file