I want to use the undetected_chromedriver package, however it is not working.
I get a NoSuchElementException. However, when I run the same code locally on my device, works fine.
Here is the code:
import config
import time
import undetected_chromedriver as uc
import random
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
import telebot
chrome_options = uc.ChromeOptions()
chrome_options.add_argument("--disable-gpu")
bot = telebot.TeleBot(config.token)
driver = uc.Chrome(options = chrome_options,version_main = 90,headless=True,no_sandbox=True)
bot.send_message(config.chat_id_serc, 'started')
url = 'someurl'
time.sleep(2)
driver.get(url)
time.sleep(10)
driver.find_element('name', 'Username').send_keys(config.membership_no)
The only difference is that locally I can use chrome driver version 112 (version_main = 112).