0

Selenium and Chrome verions:

import selenium selenium.version '4.10.0'

Chrome Version: 114.0.5735.91 (Official Build) (64-bit)

This code used to work for me just fine:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By

My_Link = "......"

DRIVER_PATH = 'I://Decoded//chromedriver.exe'
s=Service(DRIVER_PATH)
browser = webdriver.Chrome(service=s)

browser.get(My_Link)
browser.find_element(By.NAME,"USER").send_keys(r)
browser.find_element(By.NAME,"PASSWORD").send_keys(d)
browser.find_element(By.CSS_SELECTOR,".ButtonSm").click()

cookies= browser.get_cookies()

It's now giving me this error:

WebDriverException                        Traceback (most recent call last)
<ipython-input-10-b6bb484d2c6a> in <module>
      1
      2 
----> 3 cookies= browser.get_cookies()

WebDriverException: Message: unknown error: Runtime.callFunctionOn threw exception: TypeError: JSON.stringify is not a function
    at buildError (<anonymous>:323:18)
  (Session info: chrome=114.0.5735.91)
Stacktrace:
Backtrace:
    GetHandleVerifier [0x010CA813+48355]
    (No symbol) [0x0105C4B1]

Any idea what is causing this exception pls ?

I tried microsoft edge, same issue.

Shawn
  • 4,064
  • 2
  • 11
  • 23

2 Answers2

1

Since you are using selenium version v4.10.0, setting the driver.exe path is optional. You can replace the below code:

DRIVER_PATH = 'I://Decoded//chromedriver.exe'
s=Service(DRIVER_PATH)
browser = webdriver.Chrome(service=s)

To simply:

browser = webdriver.Chrome()

Reference - https://stackoverflow.com/a/76463081/7598774

Shawn
  • 4,064
  • 2
  • 11
  • 23
  • New command not working. Giving this error: WebDriverException: Message: Unsuccessful command executed: C:\Users\.............\Anaconda3\lib\site-packages\selenium\webdriver\common\windows\selenium-manager.exe --browser chrome --output json. A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond – NayR MiMde Jun 19 '23 at 15:08
0

This error message...

WebDriverException: Message: unknown error: Runtime.callFunctionOn threw exception: TypeError: JSON.stringify is not a function

...is a regression issue due to recent changes in the ChromeDriver binary.

This issue was discussed in the thread org.openqa.selenium.WebDriverException: unknown error: Runtime.callFunctionOn threw exception: TypeError: value.hasOwnProperty is not a function at Object.stringify and this issue requires fix in ChromeDriver.


tl; dr

WebDriverException: unknown error: Runtime.callFunctionOn threw exception: TypeError: JSON.stringify is not a function using Selenium and ChromeDriver

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • I see. Do you know if there's any other way for me to get the Cookies from a Secured Siteminder login? I am able to login using Selenium but just failing to get the cookies. currently this line is the one failing for me: cookies= driver.get_cookies() – NayR MiMde Jun 20 '23 at 10:24
  • I already asked you if the url is public, so we can access/test :) – undetected Selenium Jun 20 '23 at 10:36
  • Apologies i missed that. No, the URL is not public. It's an internal webtool within my company that is not accessible externally. Are there any tests you'd like me to perform on your behalf and paste here the results ? – NayR MiMde Jun 20 '23 at 12:59