KraKoff_
KraKoff_

Reputation: 37

Empty Console Output Python

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

Upvotes: 0

Views: 130

Answers (2)

KraKoff_
KraKoff_

Reputation: 37

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

Upvotes: 0

data_sc
data_sc

Reputation: 457

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

Upvotes: 1

Related Questions