Python and Selenium - Reuse a whatsapp web session

后端 未结 1 1238
我在风中等你
我在风中等你 2021-01-28 03:23

I want to reuse a whatsapp web session via Python 3 and Selenium on Chromedriver.

For which I need to grab the localstorage of an existing session and set it to the new

1条回答
  •  盖世英雄少女心
    2021-01-28 04:10

    this is how you can reuse a whatsapp web session by storing cookies.

    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    
    chrome_options = Options()
    chrome_options.add_argument("--user-data-dir=chrome-data")
    driver = webdriver.Chrome('chromedriver.exe',options=chrome_options)
    driver.get('https://web.whatsapp.com')
    time.sleep(30)
    

    0 讨论(0)
提交回复
热议问题