feat: polish code and wait 3 seconds to achieve submit.
TODO: Improve time.sleep
This commit is contained in:
parent
8cb3e3b9f6
commit
8564a51243
25
main.go
25
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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue