Nitiksh Kumar
Nitiksh Kumar

Reputation: 1

I am trying to open the chrome signed profile but not so working properly (Python)

I am facing a problem while trying to open a Chrome signed profile using Selenium WebDriver. Although the signed-in profile opens successfully, other operations fail, and I encounter the following error:

Opening in existing browser session.
Error occurred while initializing Chrome WebDriver: Message: session not created: Chrome failed to start: exited normally.
  (session not created: DevToolsActivePort file doesn't exist)
  (The process started from chrome location C:\Program Files (x86)\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
        GetHandleVerifier [0x00007FF7C7AA1502+60802]
        (No symbol) [0x00007FF7C7A1AC02]
        (No symbol) [0x00007FF7C78D7CE4]
        (No symbol) [0x00007FF7C790F30A]
        (No symbol) [0x00007FF7C790AA64]
        (No symbol) [0x00007FF7C7956037]
        (No symbol) [0x00007FF7C79556B0]
        (No symbol) [0x00007FF7C794A923]
        (No symbol) [0x00007FF7C7918FEC]
        (No symbol) [0x00007FF7C7919C21]
        GetHandleVerifier [0x00007FF7C7DA411D+3217821]
        GetHandleVerifier [0x00007FF7C7DE60B7+3488055]
        GetHandleVerifier [0x00007FF7C7DDF03F+3459263]
        GetHandleVerifier [0x00007FF7C7B5B846+823494]
        (No symbol) [0x00007FF7C7A25F9F]
        (No symbol) [0x00007FF7C7A20EC4]
        (No symbol) [0x00007FF7C7A21052]
        (No symbol) [0x00007FF7C7A118A4]
        BaseThreadInitThunk [0x00007FFC4FB8257D+29]
        RtlUserThreadStart [0x00007FFC50FEAA48+40]

Here is my code:

import json
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from bs4 import BeautifulSoup

# URL of the webpage to scrape
url = "https://www.amazon.in/Campus-Hurricane-D-Gry-Running-Shoes/dp/B0BBG64HRD/ref=pd_day0fbt_thbs_d_sccl_2/262-1957664-3099652?pd_rd_w=WWZCL&content-id=amzn1.sym.9fcd4617-323e-42b7-9728-3395e1b2fea0&pf_rd_p=9fcd4617-323e-42b7-9728-3395e1b2fea0&pf_rd_r=A1MEFD8G540FFHH1F2Y6&pd_rd_wg=C2CPc&pd_rd_r=980663a7-f5a1-4af7-989d-33b7bbef7c1b&pd_rd_i=B0BBG64HRD&psc=1"

# Configure Chrome options to use an existing Chrome profile
chrome_options = Options()
chrome_options.add_argument("user-data-dir=C:\\Users\\hp\\AppData\\Local\\Google\\Chrome\\User Data")
chrome_options.add_argument("profile-directory=Profile 2")

# Initialize a WebDriver with Chrome options
try:
    driver = webdriver.Chrome(options=chrome_options)
except Exception as e:
    print("Error occurred while initializing Chrome WebDriver:", e)
    exit()

# Open the webpage
try:
    driver.get(url)
except Exception as e:
    print("Error occurred while opening the webpage:", e)
    driver.quit()
    exit()

Can someone help me understand what might be causing this issue and how to resolve it? Thank you!

I attempted to open a Chrome signed profile using Selenium WebDriver. I expected the signed-in profile to open successfully and for the subsequent operations to execute without errors. However, upon running the code, I encountered an error stating that Chrome failed to start, along with a stack trace indicating that the DevToolsActivePort file doesn't exist.

Upvotes: 0

Views: 205

Answers (0)

Related Questions