Hello all,
I've searched the group as suggested and while I do see the error we are facing I'm not seeing a lot of feedback on fixes.
Error and our settings:
11:12:24.058 [INFO] org.openqa.selenium.remote.ErrorCodes HTTP Status: '500' -> incorrect JSON status mapping for 'script timeout' (408 expected)
11:12:24.060 [WARN]
com.humana.wfrpa.components.pahub.page.Page TESTING. Exception in waitForElement Timed out waiting for script to complete.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'SIMXDWWKF0472', ip: '10.101.35.163',
os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_262'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{se:ieOptions={browserAttachTimeout=0, enablePersistentHover=false, ie.forceCreateProcessApi=false, ie.edgepath=C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe,
ignoreZoomSetting=true,
ie.fileUploadDialogTimeout=3000, nativeEvents=true, ie.edgechromium=true,
ie.ensureCleanSession=true,
elementScrollBehavior=0, ie.browserCommandLineSwitches=,
requireWindowFocus=true,
initialBrowserUrl=
http://localhost:37576/,
ignoreProtectedModeSettings=true},
timeouts={implicit=0, pageLoad=300000, script=30000}, pageLoadStrategy=normal, unhandledPromptBehavior=dismiss and notify, strictFileInteractability=false, platform=XP, proxy=Proxy(), acceptInsecureCerts=false, browserVersion=11, browserName=internet explorer, javascriptEnabled=true, platformName=XP, setWindowRect=true}]
We have it set to check for 60 seconds at 200ms polling, after that first iteration it errors out. We're converting from IE to Edge's IE mode so this code worked in IE Driver 3.8, but my understanding is 4.0 is needed to work with Edge's IE mode.
Our code.
Starts like
protected Optional<WebElement> waitForElement(By element) {
return waitForElement(WaitCondition.VISIBLE, element, 60L, 500L);
}
From there it goes to
waitForElement(ExpectedConditions.visibilityOfElementLocated(element), timeout, polling);
Then to
Optional<WebElement> waitForElement(ExpectedCondition<WebElement> expectedCondition, long timeout, long polling) {
try {
LOGGER.debug("TESTING. before rpaDriver.enableRpaPollingTimeout()");
rpaDriver.enableRpaPollingTimeout();
LOGGER.debug("TESTING. before rpaDriver.fluentWait()");
return Optional.of(rpaDriver.fluentWait()
.withTimeout(timeout, TimeUnit.SECONDS)
.pollingEvery(polling, TimeUnit.MILLISECONDS)
.ignoring(NoSuchElementException.class)
.ignoring(InvalidSelectorException.class)
.ignoring(StaleElementReferenceException.class)
.until(expectedCondition));
} catch (Exception e) {
LOGGER.warn("TESTING. Exception in waitForElement {}", e.getMessage());
return Optional.empty();
} finally {
LOGGER.debug("TESTING. before rpaDriver.enableRpaDefaultTimeout()");
rpaDriver.enableRpaDefaultTimeout();
}
}
Deeper in code it is
public static FluentWait<WebDriver> Wait() {
return (new FluentWait(driver())).withTimeout(getFluentWaitTimeout(), TimeUnit.MILLISECONDS).pollingEvery(getFluentWaitPollingInterval(), TimeUnit.MILLISECONDS);
}
So it is about wait till condition of element visibility reached, timeout is X seconds, polling every Y milliseconds. Throws an exception right on first iteration. When I added script timeout exception as .ignoring(Z) then we just getting lots of 408 errors and then timeout exception.
Any help or suggestions that can be provided would be of huge help. Thanks!
Doug