0

I am automating certain tasks using Web Browser with Selenium. Suppose I open a webpage say Facebook or Quora using webdriver, the page that opened asks for the username and password again even though I am still logged in.

from selenium import webdriver

b = webdriver.Chrome()
b.get("https://www.quora.com/")

enter image description here

I want the webdriver to use and retain the information of the current session so that I am able to land on my profile without having to enter my username and password again. How can I achieve this? Thanks.

Edit 1 : I tried pointing it to the chrome user data, but isn't working.

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_option = Options()
chrome_option.add_argument('user-data-dir=~/Library/Application Support/Google/Chrome/Default')
b = webdriver.Chrome(executable_path="/Users/mymac/Downloads/chromedriver",chrome_options=chrome_option)
b.get("https://www.quora.com/")
sagar_jeevan
  • 761
  • 5
  • 16
  • 34

0 Answers0