I am working on selenium automation using java. Selenium version used : 4.10.0
Though I see two tabs ( 1. parent tab main page and 2. is the child tab) but when I switch to child through below code I don`t see any kind of exception thrown. But when I perform any operations like click on any button in child window it throws an exception "TypeError: JSON.stringify is not a function".
Below is the code snippet.
//Loop through until we find a new window handle
for (String windowHandle : driver.getWindowHandles()) { if(!originalWindow.contentEquals(windowHandle)) { System.out.println("Child win : "+windowHandle); driver.switchTo().window(windowHandle); break; } }
driver.findElement(By.name("aspnetForm")).click();
Can somebody please advise me here why i should be getting this error "Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Runtime.callFunctionOn threw exception: TypeError: JSON.stringify is not a function"
Consloe log below :
Child win : DEFC56C2E255CB00E7CF1C779B81E7EE Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Runtime.callFunctionOn threw exception: TypeError: JSON.stringify is not a function at buildError (:323:18) (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: '11.0.18' Driver info: org.openqa.selenium.chrome.ChromeDriver Command: [748156ce82a3898c61c8bc461a5ecbbb, findElement {using=name, value=aspnetForm}] Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 114.0.5735.199, chrome: {chromedriverVersion: 114.0.5735.90 (386bc09e8f4f..., userDataDir: C:\Users\baluz\AppData\Loca...}, goog:chromeOptions: {debuggerAddress: localhost:58574}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: windows, proxy: Proxy(), se:cdp: ws://localhost:58574/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: 748156ce82a3898c61c8bc461a5ecbbb at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) 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.findElement(ElementLocation.java:165) at org.openqa.selenium.remote.ElementLocation.findElement(ElementLocation.java:66) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:350) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:344) at com.basePage.EX3.main(EX3.java:91)