添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account [🐛 Bug]: Driver.findElements throwing org.openqa.selenium.WebDriverException: unknown error: Runtime.callFunctionOn threw exception: TypeError: value.hasOwnProperty is not a function #12366 [🐛 Bug]: Driver.findElements throwing org.openqa.selenium.WebDriverException: unknown error: Runtime.callFunctionOn threw exception: TypeError: value.hasOwnProperty is not a function #12366 Deepika-Acharya opened this issue Jul 14, 2023 · 8 comments

What happened?

org.openqa.selenium.JavascriptException: javascript error: value.propertyIsEnumerable is not a function
(Session info: chrome=114.0.5735.199)
Build info: version: '4.10.0', revision: 'c14d967899'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [c59a591b6f9cbf22f4f7f51e861b1224, findElements {using=xpath, value=//span[contains( @id ,'tag')]}]
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 114.0.5735.199, chrome: {chromedriverVersion: 114.0.5735.90 (386bc09e8f4f..., userDataDir: C:\Users\Dach~\AppData\Lo...}, goog:chromeOptions: {debuggerAddress: localhost:56169}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: windows, proxy: Proxy(), se:cdp: ws://localhost:56169/devtoo..., se:cdpVersion: 114.0.5735.199, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
Session ID: c59a591b6f9cbf22f4f7f51e861b1224

How can we reproduce the issue?

This issue is observed when we are trying to run below 
List<WebElement> div1 = driver.findElements(By.tagName("div"));
System.out.println(div1.size());

Relevant log output

org.openqa.selenium.JavascriptException: javascript error: value.propertyIsEnumerable is not a function

Operating System

Window 10

Selenium version

Selenium 4.10

What are the browser(s) and version(s) where you see this issue?

Chrome 114.0.5735.199

What are the browser driver(s) and version(s) where you see this issue?

Chrome driver V114.0.5735.90

Are you using Selenium Grid?

No response

@Deepika-Acharya , thank you for creating this issue. We will troubleshoot it as soon as we can.

Info for maintainers Triage this issue by using labels. If information is missing, add a helpful comment and then I-issue-template label. If the issue is a question, add the I-question label. If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label. If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue. After troubleshooting the issue, please add the R-awaiting answer label. Thank you!

Can you turn on logging and report the results. I don't see where Selenium would throw a JavaScript exception based on that code.

https://www.selenium.dev/documentation/webdriver/troubleshooting/logging/

It seems like the error is due to different line of code rather than the one you provided,
the error clearly says
Command: [c59a591b6f9cbf22f4f7f51e861b1224, findElements {using=xpath, value=//span[contains( @id ,'tag')]}]

So, I recommend you check the other lines of code as well.

Also make sure to synchronize the page load with your code, by explicitly or implicitly adding wait time.

Hi @iambstha ,
Sorry my bad, I made a mistake while pasting the console output.
Actually, whether we are using findElements we are getting the " org.openqa.selenium.JavascriptException: javascript error: value.propertyIsEnumerable is not a function " after particular functionality of the application for example Login.
I had done some R&D on this issue and found that value.propertyIsEnumerable used in one of the js files of the application which is named "json2.js" but I am not sure how it is link to the error.

As per @titusfortner , I have added the logger to my code, and below mentioned are my code & Condole Output
Please note I cannot the application URL as it is a client internal link so I have removed it from the below Console output.

List div2 = driver.findElements(By.tagName("div"));
System.out.println("Div tag count after login : " + div2.size() + "\n");

Console Output

[RemoteTestNG] detected TestNG version 7.8.0
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Starting ChromeDriver 114.0.5735.90 (386bc09e8f4f2e025eddae123f36f6263096ae49-refs/branch-heads/5735@{ #1052 }) on port 1175
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Browser version: 114.0.5735.199

Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executing: maximizeCurrentWindow [c5eda2ceda2da508bf6bc3f3d305d0d7, maximizeCurrentWindow {}]
Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec decode
FINE: Decoding response. Response code was: 200 and content: {"value":{"height":1056,"width":1936,"x":-8,"y":-8}}
Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executed: maximizeCurrentWindow (Response: SessionID: c5eda2ceda2da508bf6bc3f3d305d0d7, Status: 0, Value: {height=1056, width=1936, x=-8, y=-8})
Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executing: get [c5eda2ceda2da508bf6bc3f3d305d0d7, get {url=}]
Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec decode
FINE: Decoding response. Response code was: 200 and content: {"value":null}
Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executed: get (Response: SessionID: c5eda2ceda2da508bf6bc3f3d305d0d7, Status: 0, Value: null)
Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executing: findElements [c5eda2ceda2da508bf6bc3f3d305d0d7, findElements {using=xpath, value=//button[ @id ='details-button' and contains(text(),'Advanced')]}]
Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec decode
FINE: Decoding response. Response code was: 200 and content: {"value":[{"element-6066-11e4-a52e-4f735466cecf":"FB0C161EAD7C549BE9DC17178FA32F48_element_4"}]}
Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executed: findElements (Response: SessionID: c5eda2ceda2da508bf6bc3f3d305d0d7, Status: 0, Value: [{element-6066-11e4-a52e-4f735466cecf=FB0C161EAD7C549BE9DC17178FA32F48_element_4}])
Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executing: clickElement [c5eda2ceda2da508bf6bc3f3d305d0d7, clickElement {id=FB0C161EAD7C549BE9DC17178FA32F48_element_4}]
Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec decode
FINE: Decoding response. Response code was: 200 and content: {"value":null}
Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executed: clickElement (Response: SessionID: c5eda2ceda2da508bf6bc3f3d305d0d7, Status: 0, Value: null)
Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executing: findElement [c5eda2ceda2da508bf6bc3f3d305d0d7, findElement {using=xpath, value=//a[ @id ='proceed-link']}]
Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec decode
FINE: Decoding response. Response code was: 200 and content: {"value":{"element-6066-11e4-a52e-4f735466cecf":"FB0C161EAD7C549BE9DC17178FA32F48_element_11"}}
Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executed: findElement (Response: SessionID: c5eda2ceda2da508bf6bc3f3d305d0d7, Status: 0, Value: {element-6066-11e4-a52e-4f735466cecf=FB0C161EAD7C549BE9DC17178FA32F48_element_11})
Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executing: clickElement [c5eda2ceda2da508bf6bc3f3d305d0d7, clickElement {id=FB0C161EAD7C549BE9DC17178FA32F48_element_11}]
Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec decode
FINE: Decoding response. Response code was: 200 and content: {"value":null}
Jul 16, 2023 2:34:04 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executed: clickElement (Response: SessionID: c5eda2ceda2da508bf6bc3f3d305d0d7, Status: 0, Value: null)
Jul 16, 2023 2:34:53 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executing: findElements [c5eda2ceda2da508bf6bc3f3d305d0d7, findElements {using=tag name, value=div}]
Jul 16, 2023 2:34:53 AM org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec decode
FINE: Decoding response. Response code was: 500 and content: {"value":{"error":"javascript error","message":"javascript error: value.propertyIsEnumerable is not a function\n (Session info: chrome=114.0.5735.199)","stacktrace":"Backtrace:\n\tGetHandleVerifier [0x00CCA813+48355]\n\t(No symbol) [0x00C5C4B1]\n\t(No symbol) [0x00B65358]\n\t(No symbol) [0x00B687A1]\n\t(No symbol) [0x00B699E1]\n\t(No symbol) [0x00B69A80]\n\t(No symbol) [0x00B9061C]\n\t(No symbol) [0x00B90B3B]\n\t(No symbol) [0x00BBE26C]\n\t(No symbol) [0x00BAA784]\n\t(No symbol) [0x00BBC922]\n\t(No symbol) [0x00BAA536]\n\t(No symbol) [0x00B882DC]\n\t(No symbol) [0x00B893DD]\n\tGetHandleVerifier [0x00F2AABD+2539405]\n\tGetHandleVerifier [0x00F6A78F+2800735]\n\tGetHandleVerifier [0x00F6456C+2775612]\n\tGetHandleVerifier [0x00D551E0+616112]\n\t(No symbol) [0x00C65F8C]\n\t(No symbol) [0x00C62328]\n\t(No symbol) [0x00C6240B]\n\t(No symbol) [0x00C54FF7]\n\tBaseThreadInitThunk [0x759700C9+25]\n\tRtlGetAppContainerNamedObjectPath [0x77887B1E+286]\n\tRtlGetAppContainerNamedObjectPath [0x77887AEE+238]\n"}}
Jul 16, 2023 2:34:53 AM org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec decode
FINE: Processing an error
Jul 16, 2023 2:34:53 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executed: findElements (Response: SessionID: c5eda2ceda2da508bf6bc3f3d305d0d7, Status: 17, Value: org.openqa.selenium.JavascriptException: javascript error: value.propertyIsEnumerable is not a function
(Session info: chrome=114.0.5735.199)
Build info: version: '4.10.0', revision: 'c14d967899'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.1'
Driver info: driver.version: RemoteWebDriver)
Jul 16, 2023 2:34:53 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executing: quit [c5eda2ceda2da508bf6bc3f3d305d0d7, quit {}]
Jul 16, 2023 2:34:53 AM org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec decode
FINE: Decoding response. Response code was: 200 and content: {"value":null}
Jul 16, 2023 2:34:53 AM org.openqa.selenium.net.UrlChecker waitUntilUnavailable
FINE: Waiting for http://localhost:1175/shutdown
Jul 16, 2023 2:34:53 AM org.openqa.selenium.net.UrlChecker lambda$waitUntilUnavailable$2
FINE: Polling http://localhost:1175/shutdown
Jul 16, 2023 2:34:53 AM sun.net.www.protocol.http.HttpURLConnection writeRequests
FINE: sun.net.www.MessageHeader@40b39b7a5 pairs: {GET /shutdown HTTP/1.1: null}{User-Agent: Java/17.0.1}{Host: localhost:1175}{Accept: text/html, image/gif, image/jpeg, *; q=.2, / ; q=.2}{Connection: keep-alive}
Jul 16, 2023 2:34:53 AM sun.net.www.protocol.http.HttpURLConnection getInputStream0
FINE: sun.net.www.MessageHeader@2ae773ad3 pairs: {null: HTTP/1.1 200 OK}{Content-Length: 40}{Content-Type: application/json; charset=utf-8}
Jul 16, 2023 2:34:53 AM org.openqa.selenium.net.UrlChecker lambda$waitUntilUnavailable$2
FINE: Polling http://localhost:1175/shutdown
Jul 16, 2023 2:34:54 AM org.openqa.selenium.remote.RemoteWebDriver log
FINE: Executed: quit (Response: SessionID: c5eda2ceda2da508bf6bc3f3d305d0d7, Status: 0, Value: null)
FAILED: mstar_javasript_automation.Mstarjs.MstarHomeJs.atart
org.openqa.selenium.JavascriptException: javascript error: value.propertyIsEnumerable is not a function
(Session info: chrome=114.0.5735.199)
Build info: version: '4.10.0', revision: 'c14d967899'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [c5eda2ceda2da508bf6bc3f3d305d0d7, findElements {using=tag name, value=div}]
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 114.0.5735.199, chrome: {chromedriverVersion: 114.0.5735.90 (386bc09e8f4f..., userDataDir: C:\Users\Dachary\AppData\Lo...}, goog:chromeOptions: {debuggerAddress: localhost:50314}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: windows, proxy: Proxy(), se:cdp: ws://localhost:50314/devtoo..., se:cdpVersion: 114.0.5735.199, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
Session ID: c5eda2ceda2da508bf6bc3f3d305d0d7
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:199)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:132)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:51)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:191)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:196)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:171)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:531)
at org.openqa.selenium.remote.ElementLocation$ElementFinder$2.findElements(ElementLocation.java:182)
at org.openqa.selenium.remote.ElementLocation.findElements(ElementLocation.java:103)
at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:363)
at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:357)
at mstar_javasript_automation.Mstarjs.MstarHomeJs.atart(MstarHomeJs.java:105)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:664)
at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:227)
at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:957)
at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:200)
at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148)
at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:848)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:443)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:437)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:397)
at org.testng.SuiteRunner.run(SuiteRunner.java:336)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1280)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1200)
at org.testng.TestNG.runSuites(TestNG.java:1114)
at org.testng.TestNG.run(TestNG.java:1082)
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)

Please take look and let me know the solution for the same.

Thank you.

Seems like you are having a synchronization issue, I recommend you trying this:

WebDriverWait wait = new WebDriverWait(driver, 10);
List divElements = wait.until(EC.presenceOfAllElementsLocatedBy(By.tagName("div")));

Also make sure to import all these,

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.support.ui.ExpectedConditions as EC;

Also if you are using older version of ChromeDriver or Selenium WebDriver, do update them.

Hi, @Deepika-Acharya .
This issue has been determined to require fixes in ChromeDriver .

You can see if the feature is passing in the Web Platform Tests .

If it is something new, please create an issue with the ChromeDriver team.
Feel free to comment the issues that you raise back in this issue. Thank you.