undetected-chromedriver
undetected-chromedriver copied to clipboard
The browser automatically closes after opening and the time for the browser to open should be very long (about 15 seconds)
My Code : `from time import sleep from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By import undetected_chromedriver as uc
driver = uc.Chrome(use_subprocess=True) driver.get('https://nowsecure.nl')`
I am using windows 11 and Chrome version 105
everytime you run undetected chromedriver its download new chromedriver
everytime you run undetected chromedriver its download new chromedriver Is there any way to fix that? bro
i dont know any solution for this, maybe just use selenium webdriver
Hey @JenoKey ,
from the code you have shown, I can say that this is happening because you do not have a sleep() function or anything else after the script executes driver.get('https://nowsecure.nl')
, in order to have it continue or wait for user input you could do the following:
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import undetected_chromedriver as uc
driver = uc.Chrome(use_subprocess=True)
driver.get('nowsecure.nl')
time.sleep(15) # <----- required to let the driver continue and wait
@JenoKey , an alternative would be:
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import undetected_chromedriver as uc
chrome_options = uc.ChromeOptions()
chrome_options.add_experimental_option("detach", True)
driver = uc.Chrome(options=chrome_options, use_subprocess=True)
driver.get('nowsecure.nl')
When you start it detached, it does not close the window after script is done executing.
Hope my solutions helped!
@JenoKey , an alternative would be:
import time from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By import undetected_chromedriver as uc chrome_options = uc.ChromeOptions() chrome_options.add_experimental_option("detach", True) driver = uc.Chrome(options=chrome_options, use_subprocess=True) driver.get('nowsecure.nl')
When you start it detached, it does not close the window after script is done executing.
Hope my solutions helped!
Thank bro
@JenoKey @wazoooo I'm getting an error unrecognized chrome option: detach
I tried with Chrome version 105. Am I missing something? Thanks
@JenoKey @wazoooo I'm getting an error
unrecognized chrome option: detach
I tried with Chrome version 105. Am I missing something? Thanks
Try the following:
chrome_options.set_capability("detach", True)