MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / pollCondition

Method pollCondition

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

Source from the content-addressed store, hash-verified

919 let result = new Promise((resolve, reject) => {
920 const startTime = Date.now()
921 const pollCondition = async () => {
922 evaluateCondition().then(function (value) {
923 const elapsed = Date.now() - startTime
924 if (value) {
925 resolve(value)
926 } else if (timeout && elapsed >= timeout) {
927 try {
928 let timeoutMessage = resolveWaitMessage(message)
929 reject(new error.TimeoutError(`${timeoutMessage}Wait timed out after ${elapsed}ms`))
930 } catch (ex) {
931 reject(new error.TimeoutError(`${ex.message}\nWait timed out after ${elapsed}ms`))
932 }
933 } else {
934 setTimeout(pollCondition, pollTimeout)
935 }
936 }, reject)
937 }
938 pollCondition()
939 })
940

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected