Saturday, 6 August 2022

org.openqa.selenium.TimeoutException

org.openqa.selenium.TimeoutException

  • Thrown when a command does not complete in enough time.
  • For instance, in the below example, we get TimeOutException after having waited for 30 seconds 
  • This is an explicit wait technique in selenium and the element is identified using method visibilityOfElementLocated in the DOM(Document Object Model)

WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[contains(text(),'Add New Partner')]")));

Log
org.openqa.selenium.TimeoutException: Expected condition failed: waiting for visibility of element located by By.xpath: //a[contains(text(),'Add New  Partner')] (tried for 30 second(s) with 500 milliseconds interval)
Build info: version: '4.3.0', revision: 'a4995e2c09*'
System info: host: 'SADAKARP', ip: '392.100.7.2', os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.3'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 103.0.5060.134, chrome: {chromedriverVersion: 103.0.5060.53 (a1711811edd7..., userDataDir: C:\Users\sadakarp\AppData\L...}, goog:chromeOptions: {debuggerAddress: localhost:60618}, networkConnectionEnabled: false, pageLoadStrategy: none, platformName: WINDOWS, proxy: Proxy(), se:cdp: ws://localhost:60618/devtoo..., se:cdpVersion: 103.0.5060.134, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
Session ID: c13c1f6304ded0dc6587693ac3eae3b6
	at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:87)
	at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:231)

No comments:

Post a Comment