I have this code:
from selenium import webdriverfrom selenium.webdriver.chrome.service import Servicefrom time import sleep# Create a Service object by specifying the path to chromedriverchrome_service = Service(executable_path="path\crome.exe")options = webdriver.ChromeOptions()options.add_argument("user-data-dir=C:\\path_file")# Pass the Service object to webdriver.Chrome()driver = webdriver.Chrome(service=chrome_service, options=options)# Open WhatsApp Webdriver.get("https://web.whatsapp.com/")sleep(10)
When I run this code chrome opens but whatsapp web doesn't open. how to fix that?
I tried using several different methods like:
from webdriver_manager.chrome import ChromeDriverManagerdriver = webdriver.Chrome(ChromeDriverManager().install())
and:
options.add_argument("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36")
but none of them worked