On clicking an element in chrome browser in selenium-testng:

org.openqa.selenium.WebDriverException: unknown error: document.getBoxObjectFor is not a function
  (Session info: chrome=73.0.3683.103)
  (Driver info: chromedriver=2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)

is displayed as error

I tried:

wait.until(ExpectedConditions.stalenessOf(element));

Code trial:

public void clickHERE(String deal) throws Throwable
{   
    driver.findElement(By.xpath(HERE)).click();
    driver.findElement(By.xpath(enterDeal)).sendKeys(deal);
    driver.findElement(By.xpath(searchButtonDCP)).click();
    scrollToElement(driver, nextTabDealInfo);
    driver.findElement(By.xpath(nextTabDealInfo)).click();
}

For first line of code:

driver.findElement(By.xpath(HERE)).click(); 

in above function, driver should click and navigate to next page.

1 Answers

1
DebanjanB On Best Solutions

This error message...

org.openqa.selenium.WebDriverException: unknown error: document.getBoxObjectFor is not a function
  (Session info: chrome=73.0.3683.103)
  (Driver info: chromedriver=2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)

...implies that the ChromeDriver was unable to communicate with the WebBrowser i.e. Chrome Browser session.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • You are using chromedriver=2.42
  • Release Notes of chromedriver=2.42 clearly mentions the following :

Supports Chrome v68-70

  • You are using chrome=73.0
  • Release Notes of ChromeDriver v2.46 clearly mentions the following :

Supports Chrome v71-73

So there is a clear mismatch between ChromeDriver v2.42 and the Chrome Browser v73.0

Solution

  • Upgrade ChromeDriver to current ChromeDriver v2.46 level.
  • Keep Chrome version between Chrome v71-73 levels. (as per ChromeDriver v2.46 release notes)
  • If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.