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

Method pollCondition

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

Source from the content-addressed store, hash-verified

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

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