MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / pollCondition

Method pollCondition

javascript/selenium-webdriver/lib/webdriver.js:930–946  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

928 let result = new Promise((resolve, reject) => {
929 const startTime = Date.now()
930 const pollCondition = async () => {
931 evaluateCondition().then(function (value) {
932 const elapsed = Date.now() - startTime
933 if (value) {
934 resolve(value)
935 } else if (timeout && elapsed >= timeout) {
936 try {
937 let timeoutMessage = resolveWaitMessage(message)
938 reject(new error.TimeoutError(`${timeoutMessage}Wait timed out after ${elapsed}ms`))
939 } catch (ex) {
940 reject(new error.TimeoutError(`${ex.message}\nWait timed out after ${elapsed}ms`))
941 }
942 } else {
943 setTimeout(pollCondition, pollTimeout)
944 }
945 }, reject)
946 }
947 pollCondition()
948 })
949

Callers

nothing calls this directly

Calls 4

resolveWaitMessageFunction · 0.85
rejectFunction · 0.85
nowMethod · 0.80
resolveFunction · 0.50

Tested by

no test coverage detected