fix: check popup exists

This commit is contained in:
lilong.129
2023-09-21 19:52:23 +08:00
parent 4962d08fb2
commit 777912f501
+5 -2
View File
@@ -115,7 +115,10 @@ func (p *PopupInfo) isIdentical(lastPopup *PopupInfo) bool {
} }
func (p *PopupInfo) exists() bool { func (p *PopupInfo) exists() bool {
return p.PopupArea.IsEmpty() || p.CloseArea.IsEmpty() if p.PopupArea.IsEmpty() || p.CloseArea.IsEmpty() {
return false
}
return true
} }
func (dExt *DriverExt) ClosePopups(options ...ActionOption) error { func (dExt *DriverExt) ClosePopups(options ...ActionOption) error {
@@ -149,7 +152,7 @@ func (dExt *DriverExt) ClosePopupsHandler(options ...ActionOption) error {
popup := screenResult.Popup popup := screenResult.Popup
if popup == nil || !popup.exists() { if popup == nil || !popup.exists() {
log.Debug().Msg("no popup found") log.Debug().Interface("popup", popup).Msg("no popup found")
break break
} }
popup.CloseStatus = CloseStatusFound popup.CloseStatus = CloseStatusFound