From 8564a51243f88242a99e83cb560c012f71344c4f Mon Sep 17 00:00:00 2001 From: Urko Date: Wed, 1 Mar 2023 22:36:41 +0100 Subject: [PATCH] feat: polish code and wait 3 seconds to achieve submit. TODO: Improve time.sleep --- main.go | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/main.go b/main.go index ad1e914..9c64eb4 100644 --- a/main.go +++ b/main.go @@ -16,7 +16,6 @@ import ( func main() { config := cfg.NewConfig("./.env") - log.Println("config", config) log.SetFlags(log.Lmicroseconds) if config.LogFile { @@ -59,35 +58,19 @@ func main() { page.MustElement(`input[value="Skip"]`).MustClick() log.Println("SKIP DONE") - time.Sleep(time.Second * 3) - - printContent(page) - - net := page.MustElement("#Net") - log.Println("Net", net) - net.MustClick() + page.MustElement("#Net").MustClick() log.Println("Net DONE") - wlan := page.MustElement("#Net-WLAN") - log.Println("wlan", wlan) - wlan.MustClick() + page.MustElement("#Net-WLAN").MustClick() log.Println("Net-WLAN DONE") mainFrame := page.MustElement("#mainFrame").MustFrame() mainFrame.MustElement("#wlanEnable").MustClick() log.Println("wlanEnable DONE") - printContent(mainFrame) mainFrame.MustElement("#sysSubmit").MustClick() + // TODO: improve this and wait until something should happens (refresh) + time.Sleep(time.Second * 3) log.Println("task completed") } - -func printContent(page *rod.Page) { - content, err := page.HTML() - if err != nil { - log.Fatalf("page.HTML: %s\n", err) - } - - log.Println("content", content) -}