Empty Console Output Python

Issue

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

Solution

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

Answered By – KraKoff_

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published