Compare commits

...

2 Commits

Author SHA1 Message Date
Urko fc35559ab8 feat wait a little more 2023-07-02 20:16:34 +02:00
Urko c09933767b feat: archer add print message 2023-07-02 20:15:54 +02:00
1 changed files with 11 additions and 2 deletions

View File

@ -56,7 +56,7 @@ func (p ArcherAx50) Login(user, pass string) error {
}
func (p ArcherAx50) SwitchWIFI() error {
time.Sleep(time.Second * 1)
time.Sleep(time.Millisecond * 1350)
pageURL := p.page.MustInfo().URL
log.Println("p.page.MustInfo().URL", pageURL)
@ -67,7 +67,7 @@ func (p ArcherAx50) SwitchWIFI() error {
wirelessTab.MustClick()
log.Println(p.wirelessTab, "DONE")
time.Sleep(time.Millisecond * 750)
time.Sleep(time.Millisecond * 1250)
checked := p.page.MustEvaluate(&rod.EvalOptions{
JS: `() => {
return document.getElementById('` + p.chkWifi2gID + `').checked;
@ -75,6 +75,7 @@ func (p ArcherAx50) SwitchWIFI() error {
})
isChecked := checked.Value.Bool()
log.Println(getCheckedMessage(isChecked))
p.page.MustEvaluate(&rod.EvalOptions{
JS: `() => {
document.getElementById('` + p.chkWifi2gID + `').checked=` + fmt.Sprint(!isChecked) + `;
@ -93,3 +94,11 @@ func (p ArcherAx50) SwitchWIFI() error {
time.Sleep(time.Millisecond * 1500)
return nil
}
func getCheckedMessage(isChecked bool) string {
if isChecked {
return "Time to sleep, let's switch off"
}
return "Time to laborate, let's switch WIFI on"
}