0

I added and used undetected_chromedriver library, and after that the program stopped working. Did I do something wrong? Nothing is written in the console

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium import webdriver
import undetected_chromedriver as uc

options = webdriver.ChromeOptions() 
options.add_argument("start-maximized")
service = Service(executable_path="path")
driver = uc.Chrome(options=options, service=service)

driver.get("link")

Next comes the code of the program, but it worked well

Console image

2 Answers 2

1

I believe in the newer version of uc it comes with chromeoptions so you don't need to use selenium.

import undetected_chromedriver as uc

options = uc.ChromeOptions() 
driver = uc.Chrome(options=options, version_main=94) #Choose correct version
driver.get('link')
Sign up to request clarification or add additional context in comments.

Comments

0

I never figured out the options, but the problem was with the path. You need to use driver_executable_path="". And add the module import check if __name__ == '__main__':, and put all the code there. Now the program looks like this:

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium import webdriver
import undetected_chromedriver as uc

if __name__ == '__main__':
    options = webdriver.ChromeOptions() #or options = uc.ChromeOptions()
    options.add_argument("start-maximized")
    driver = uc.Chrome(options=options, driver_executable_path="path")

    driver.get("link")

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.