def get_chromedriver():
chrome_options = webdriver.ChromeOptions()
profile_dir_name = 'Profile 66'
user_data_dir = 'C:\\Users\\ПК\\AppData\\Local\\Google\\Chrome\\User Data\\{}'.format(profile_dir_name)
print(user_data_dir)
chrome_options.add_argument('--profile-directory={}'.format(profile_dir_name))
chrome_options.add_argument('user-data-dir={}'.format(user_data_dir))
chrome_options.add_argument("--disable-blink-features=AutomationControlled")
s=ChromeService(executable_path=r'C:\Users\ПК\PycharmProjects\ScriptWithSelenium\chromedriver\chromedriver.exe')
driver = webdriver.Chrome(
service=s,
options=chrome_options
)
return driver
def main():
driver = get_chromedriver()
driver.get('https://vk.com')
time.sleep(10)
driver.close()
driver.quit()
if __name__ =='__main__':
main()