undetected-chromedriver icon indicating copy to clipboard operation
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)

Open Suharaz opened this issue 2 years ago • 3 comments

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

Suharaz avatar Sep 12 '22 04:09 Suharaz

everytime you run undetected chromedriver its download new chromedriver

KucingSelenium avatar Sep 13 '22 12:09 KucingSelenium

everytime you run undetected chromedriver its download new chromedriver Is there any way to fix that? bro

Suharaz avatar Sep 13 '22 13:09 Suharaz

i dont know any solution for this, maybe just use selenium webdriver

KucingSelenium avatar Sep 14 '22 12:09 KucingSelenium

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

gigacodr avatar Sep 23 '22 02:09 gigacodr

@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!

gigacodr avatar Sep 23 '22 02:09 gigacodr

@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

Suharaz avatar Sep 23 '22 16:09 Suharaz

@JenoKey @wazoooo I'm getting an error unrecognized chrome option: detach I tried with Chrome version 105. Am I missing something? Thanks

youbek avatar Oct 24 '22 12:10 youbek

@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)

gigacodr avatar Oct 27 '22 07:10 gigacodr