First time using selenium for automated testing. But I don’t know that something abnormal occurs after opening Google Chrome.
def init_wbe_driver(chrome_data_dir):
options = ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-automation'])
options.add_experimental_option('useAutomationExtension', False)
options.add_argument("--disable-blink-features")
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_argument('--profile-directory=Default')
options.add_argument(f"--user-data-dir={chrome_data_dir}")
service = Service(ChromeDriverManager().install())
driver = webdriver.Chrome(options=options,service=service)
return driver
if __name__ == '__main__':
driver = init_wbe_driver('C:/Users/Y/AppData/Local/Google/Chrome/User Data/')
driver.get("https://izumi.finance/trade/swap")
# driver.find_element()
btton = driver.find_element(By.CSS_SELECTOR,".fweq4ws")
btton.click()
input("Press Enter to close the program...")
Exception information
selenium.common.exceptions.SessionNotCreatedException: 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\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
GetHandleVerifier [0x00C54CC3+225091]
(No symbol) [0x00B84E11]
(No symbol) [0x00A29A7A]
(No symbol) [0x00A5198C]
(No symbol) [0x00A4CF19]
(No symbol) [0x00A87C71]
(No symbol) [0x00A8790A]
(No symbol) [0x00A7F2F6]
(No symbol) [0x00A579B9]
(No symbol) [0x00A5879D]
sqlite3_dbdata_init [0x010C9A63+4064547]
sqlite3_dbdata_init [0x010D106A+4094762]
sqlite3_dbdata_init [0x010CB968+4072488]
sqlite3_dbdata_init [0x00DCC9C9+930953]
(No symbol) [0x00B907E4]
(No symbol) [0x00B8AD08]
(No symbol) [0x00B8AE31]
(No symbol) [0x00B7CAA0]
BaseThreadInitThunk [0x763A7BA9+25]
RtlInitializeExceptionChain [0x774DBDAB+107]
RtlClearBits [0x774DBD2F+191]
chrome version:123.0.6312.86
I try to execute,But Google programs carrying user data cannot be opened.
driver = init_wbe_driver('C:/Users/Y/AppData/Local/Google/Chrome/User Data/Default')