feat: polish code and wait 3 seconds to achieve submit.

TODO: Improve time.sleep
This commit is contained in:
Urko 2023-03-01 22:36:41 +01:00
parent 8cb3e3b9f6
commit 8564a51243
1 changed files with 4 additions and 21 deletions

25
main.go
View File

@ -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)
}