Compare commits
2 Commits
cc9c9354bc
...
fc35559ab8
Author | SHA1 | Date |
---|---|---|
Urko | fc35559ab8 | |
Urko | c09933767b |
|
@ -56,7 +56,7 @@ func (p ArcherAx50) Login(user, pass string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p ArcherAx50) SwitchWIFI() error {
|
func (p ArcherAx50) SwitchWIFI() error {
|
||||||
time.Sleep(time.Second * 1)
|
time.Sleep(time.Millisecond * 1350)
|
||||||
pageURL := p.page.MustInfo().URL
|
pageURL := p.page.MustInfo().URL
|
||||||
log.Println("p.page.MustInfo().URL", pageURL)
|
log.Println("p.page.MustInfo().URL", pageURL)
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ func (p ArcherAx50) SwitchWIFI() error {
|
||||||
wirelessTab.MustClick()
|
wirelessTab.MustClick()
|
||||||
log.Println(p.wirelessTab, "DONE")
|
log.Println(p.wirelessTab, "DONE")
|
||||||
|
|
||||||
time.Sleep(time.Millisecond * 750)
|
time.Sleep(time.Millisecond * 1250)
|
||||||
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;
|
||||||
|
@ -75,6 +75,7 @@ func (p ArcherAx50) SwitchWIFI() error {
|
||||||
})
|
})
|
||||||
|
|
||||||
isChecked := checked.Value.Bool()
|
isChecked := checked.Value.Bool()
|
||||||
|
log.Println(getCheckedMessage(isChecked))
|
||||||
p.page.MustEvaluate(&rod.EvalOptions{
|
p.page.MustEvaluate(&rod.EvalOptions{
|
||||||
JS: `() => {
|
JS: `() => {
|
||||||
document.getElementById('` + p.chkWifi2gID + `').checked=` + fmt.Sprint(!isChecked) + `;
|
document.getElementById('` + p.chkWifi2gID + `').checked=` + fmt.Sprint(!isChecked) + `;
|
||||||
|
@ -93,3 +94,11 @@ func (p ArcherAx50) SwitchWIFI() error {
|
||||||
time.Sleep(time.Millisecond * 1500)
|
time.Sleep(time.Millisecond * 1500)
|
||||||
return nil
|
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"
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue