refactor: parameterize submit delay

This commit is contained in:
2023-12-27 07:38:48 +01:00
parent cc7a59c109
commit 69389d030b
6 changed files with 27 additions and 12 deletions

View File

@@ -5,6 +5,7 @@ import (
"log"
"time"
"gitea.urkob.com/urko/go-wifi-switcher/pkg/provider"
"github.com/go-rod/rod"
)
@@ -56,7 +57,7 @@ func (p ArcherAx50) Login(user, pass string) error {
return nil
}
func (p ArcherAx50) SwitchWIFI() error {
func (p ArcherAx50) SwitchWIFI(cfg provider.SwitchConfig) error {
pageURL := p.page.MustInfo().URL
log.Println("p.page.MustInfo().URL", pageURL)
@@ -94,7 +95,7 @@ func (p ArcherAx50) SwitchWIFI() error {
saveButton.MustClick()
log.Println(p.saveButtonID, "DONE")
time.Sleep(time.Millisecond * 7500)
time.Sleep(time.Millisecond * cfg.SubmitDelay)
return nil
}