2

I am using latest chrome version(76.0.3809.100) and selenium latest version(3.141.59) with latest webdriver manager version(3.6.2) and issue is occuring showing script return unexpected result.

As per search related to this problem on stackoverflow i have checked all links and tried with upgrading each chrome and selenium but none works.

Here is the pom.xml

      <dependency>
        <groupId>io.github.bonigarcia</groupId>
        <artifactId>webdrivermanager</artifactId>
        <version>3.6.2</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.14.3</version>
    </dependency>

Code that is accessing xpath

List<WebElement> allVINs = null;
try {
         allVINs =     driver.findElements(By.xpath("//a[@target='_blank']"));
    } catch (Exception e1) {
        Log.info("Something wrong with storing element in the list and the issue is: " + e1);
        e1.printStackTrace();
    }

I expect to run it successfully without errors but it shows exception like below

INFO: Detected dialect: W3C
org.openqa.selenium.WebDriverException: unknown error: script returns unexpected result
(Session info: chrome=76.0.3809.100)
Build info: version: '3.141.59', revision: 'e82be7d358', time:'2018-11-14T08:17:03'
System info: host: 'PC name', ip: 'ipAddress', os.name: 'Windows 10',     os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_144'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome,     browserVersion: 76.0.3809.100, chrome: {chromedriverVersion: 76.0.3809.68 (420c9498db8ce..., userDataDir: C:\Users\VIVEK~1.SIN\AppDat...}, goog:chromeOptions: {debuggerAddress: localhost:59659}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: dbb14cb4d3a103864093b7d121bd29f0
*** Element info: {Using=xpath, value=//a[@target='_blank']}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:353)
at org.openqa.selenium.remote.RemoteWebDriver.findElementsByXPath(RemoteWebDriver.java:432)
at org.openqa.selenium.By$ByXPath.findElements(By.java:348)
at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:311)
at com.Adesa.Utilities.WebDriverUtils.getVINlist(WebDriverUtils.java:896)
at com.Adesa.Utilities.Environment.WriteExcelData(Environment.java:76)
at com.Adesa.Actions.DDO.DDOActions.createExcelFileToUpload(DDOActions.java:41)
at com.Adesa.Local.TestCases.DDO.DDOFunctionalTestCases.AddVINsToDDOTest(DDOFunctionalTestCases.java:24)
at com.Adesa.Local.TestCases.Functional.Admin_FunctionalTestCases.AdminFunctionalTestCases(Admin_FunctionalTestCases.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:583)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:648)
at org.testng.TestRunner.run(TestRunner.java:505)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
at org.testng.SuiteRunner.run(SuiteRunner.java:364)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
at org.testng.TestNG.runSuites(TestNG.java:1049)
at org.testng.TestNG.run(TestNG.java:1017)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Vivek Singh
  • 21
  • 1
  • 5
  • Getting exception on the following line: allVINs = driver.findElements(By.xpath("//a[@target='_blank']")); – Vivek Singh Aug 12 '19 at 07:50
  • Is it working in Firefox / gecko driver ? Or you are getting same error – Rahul L Aug 12 '19 at 14:26
  • 2
    You're not alone: https://stackoverflow.com/questions/57329519/i-get-script-returns-unexpected-result-error-in-selenium-after-update-v76 May be related to "w3c" option?: https://github.com/angular/protractor/issues/5261 – pcalkins Aug 12 '19 at 20:25
  • It is working fine in Firefox browser / gecko driver. – Vivek Singh Aug 13 '19 at 05:41
  • As suggested for chrome set w3c=false and check options.setExperimentalOption("w3c", false); – Rahul L Aug 13 '19 at 06:00
  • After setting w3c=false, it is still not working. – Vivek Singh Aug 13 '19 at 06:27
  • temporary workaround is to downgrade the browser to 75. It is obviously a problem with chromedriver – Sergey Pleshakov Aug 14 '19 at 14:41
  • Try downgrading your chromedriver to 75 (https://stackoverflow.com/questions/57315463/chromedriver-76-0-3809-68-is-throwing-exception-with-selectbyvisibletext-method) – Karl Aug 14 '19 at 23:43

0 Answers0