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() { func main() {
config := cfg.NewConfig("./.env") config := cfg.NewConfig("./.env")
log.Println("config", config)
log.SetFlags(log.Lmicroseconds) log.SetFlags(log.Lmicroseconds)
if config.LogFile { if config.LogFile {
@ -59,35 +58,19 @@ func main() {
page.MustElement(`input[value="Skip"]`).MustClick() page.MustElement(`input[value="Skip"]`).MustClick()
log.Println("SKIP DONE") log.Println("SKIP DONE")
time.Sleep(time.Second * 3) page.MustElement("#Net").MustClick()
printContent(page)
net := page.MustElement("#Net")
log.Println("Net", net)
net.MustClick()
log.Println("Net DONE") log.Println("Net DONE")
wlan := page.MustElement("#Net-WLAN") page.MustElement("#Net-WLAN").MustClick()
log.Println("wlan", wlan)
wlan.MustClick()
log.Println("Net-WLAN DONE") log.Println("Net-WLAN DONE")
mainFrame := page.MustElement("#mainFrame").MustFrame() mainFrame := page.MustElement("#mainFrame").MustFrame()
mainFrame.MustElement("#wlanEnable").MustClick() mainFrame.MustElement("#wlanEnable").MustClick()
log.Println("wlanEnable DONE") log.Println("wlanEnable DONE")
printContent(mainFrame)
mainFrame.MustElement("#sysSubmit").MustClick() mainFrame.MustElement("#sysSubmit").MustClick()
// TODO: improve this and wait until something should happens (refresh)
time.Sleep(time.Second * 3)
log.Println("task completed") 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)
}