-1

How to use undetected_chromedriver.v2 in kali linux

import undetected_chromedriver.v2 as uc
options = uc.ChromeOptions()

# setting profile
options.user_data_dir = "c:\\temp\\profile"

# another way to set profile is the below (which takes precedence if both variants are used
options.add_argument('--user-data-dir=c:\\temp\\profile2')

# just some options passing in to skip annoying popups
options.add_argument('--no-first-run --no-service-autorun --password-store=basic')
bw = uc.Chrome(options=options, version_main=92) 
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Hussnain_Root
  • 33
  • 1
  • 6

1 Answers1

0

If you are on then using undetected_chromedriver.v2 you will face an error as:

TypeError: __init__() got an unexpected keyword argument 'service'

which is inline as per the status:

July 2021: Currently busy implementing selenium 4 for undetected-chromedriver


However with you can still use the undetected_chromedriver v1 as follows:

import undetected_chromedriver as uc
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service

options = uc.ChromeOptions() 
options.add_argument("start-maximized")
s = Service('C:\\BrowserDrivers\\chromedriver.exe')
driver = uc.Chrome(service=s, options=options)
driver.get('https://datadome.co/customers-stories/toppreise-ends-web-scraping-and-content-theft-with-datadome/')
driver.save_screenshot('datadome_undetected_webddriver.png')

References

You can find a couple of relevant detailed discussions in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352