Skip to content

Commit

Permalink
Fix to log the text of element during polling (#23)
Browse files Browse the repository at this point in the history
Signed-off-by: Kotaro Inoue <[email protected]>
  • Loading branch information
musaprg authored Jul 10, 2023
1 parent d639342 commit 97d40fb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion librarejob/rarejob_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ import (
func waitUntilElementLoaded(wd selenium.WebDriver, by, value string) error {
var err error
if waitErr := wd.WaitWithTimeoutAndInterval(func(wd selenium.WebDriver) (bool, error) {
_, err = wd.FindElement(by, value)
elm, err := wd.FindElement(by, value)
zap.L().Debug("checking if the element has been loaded", zap.String("by", by), zap.String("value", value))
if err == nil {
text, _ := elm.Text()
zap.L().Debug("element has been loaded", zap.String("by", by), zap.String("value", value), zap.String("text", text))
}
return err == nil, nil
}, defaultWaitTimeout, defaultWaitInterval); waitErr != nil {
return err
Expand All @@ -27,6 +32,9 @@ func waitUntilURLChanged(wd selenium.WebDriver, url string) error {
u := ""
if waitErr := wd.WaitWithTimeoutAndInterval(func(wd selenium.WebDriver) (bool, error) {
u, err = wd.CurrentURL()
if err != nil {
return false, err
}
zap.L().Debug("checking if the url has been changed", zap.String("url", u))
return u == url, nil
}, defaultWaitTimeout, defaultWaitInterval); waitErr != nil {
Expand Down

0 comments on commit 97d40fb

Please sign in to comment.