Compare commits

...

2 Commits

Author SHA1 Message Date
Urko 62bda54d98 feat: adjust waiting times 2023-07-02 23:56:23 +02:00
Urko 0933174ea1 fix bug 2023-07-02 23:28:38 +02:00
1 changed files with 6 additions and 5 deletions

View File

@ -29,7 +29,7 @@ func NewArcherAx50(page *rod.Page) ArcherAx50 {
} }
func (p ArcherAx50) Login(user, pass string) error { func (p ArcherAx50) Login(user, pass string) error {
time.Sleep(time.Millisecond * 1850) time.Sleep(time.Millisecond * 5550)
p.page.MustEvaluate(&rod.EvalOptions{ p.page.MustEvaluate(&rod.EvalOptions{
JS: `() => { JS: `() => {
@ -38,7 +38,7 @@ func (p ArcherAx50) Login(user, pass string) error {
v.focus(); v.focus();
v.value="` + pass + `"; v.value="` + pass + `";
}) })
return log; return '';
}`, }`,
}) })
@ -57,7 +57,7 @@ func (p ArcherAx50) Login(user, pass string) error {
} }
func (p ArcherAx50) SwitchWIFI() error { func (p ArcherAx50) SwitchWIFI() error {
time.Sleep(time.Millisecond * 1350) time.Sleep(time.Millisecond * 1850)
pageURL := p.page.MustInfo().URL pageURL := p.page.MustInfo().URL
log.Println("p.page.MustInfo().URL", pageURL) log.Println("p.page.MustInfo().URL", pageURL)
@ -68,7 +68,7 @@ func (p ArcherAx50) SwitchWIFI() error {
wirelessTab.MustClick() wirelessTab.MustClick()
log.Println(p.wirelessTab, "DONE") log.Println(p.wirelessTab, "DONE")
time.Sleep(time.Millisecond * 1250) time.Sleep(time.Millisecond * 1850)
checked := p.page.MustEvaluate(&rod.EvalOptions{ checked := p.page.MustEvaluate(&rod.EvalOptions{
JS: `() => { JS: `() => {
return document.getElementById('` + p.chkWifi2gID + `').checked; return document.getElementById('` + p.chkWifi2gID + `').checked;
@ -84,6 +84,7 @@ func (p ArcherAx50) SwitchWIFI() error {
}`, }`,
}) })
time.Sleep(time.Millisecond * 150)
log.Println(p.chkWifi2gID, "DONE") log.Println(p.chkWifi2gID, "DONE")
saveButton, err := p.page.Element(p.saveButtonID) saveButton, err := p.page.Element(p.saveButtonID)
if err != nil { if err != nil {
@ -92,7 +93,7 @@ func (p ArcherAx50) SwitchWIFI() error {
saveButton.MustClick() saveButton.MustClick()
log.Println(p.saveButtonID, "DONE") log.Println(p.saveButtonID, "DONE")
time.Sleep(time.Millisecond * 1500) time.Sleep(time.Millisecond * 5500)
return nil return nil
} }