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
CodePudding user response:
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')
CodePudding user response:
I never figured out the options, but the problem was with the path. Need to use driver_executable_path="". And add a condition 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")