0

i have generated a .txt file containing all the cookies from my active session in Chrome using cookies.txt extension and i want to export them to use in a chromedriver session of Selenium to login a site that requires authentication.

from selenium import webdriver 
from selenium.webdriver.common.by import By 
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC 
from selenium.common.exceptions import TimeoutException



option = webdriver.ChromeOptions()
browser = webdriver.Chrome()
browser.get('https://www.amazon.co.uk/')

I hope you can guide me with your knownledge... thanks !!!

  • [here](https://stackoverflow.com/questions/15058462/how-to-save-and-load-cookies-using-python-selenium-webdriver) are some examples that might help you. – Chai Apr 03 '18 at 13:36

1 Answers1

1

It might not be the answer for the question but i've found that i can use all the data os my current Chrome profile to log-in and run the script....correctly,like the following::

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC 
from selenium.common.exceptions import TimeoutExceptio

options = webdriver.ChromeOptions()
options.add_argument("--user-data- 
dir=C:/Users/MyPC/AppData/Local/Google/Chrome/User Data")
driver = webdriver.Chrome(chrome_options=options)
driver.get("page to be loaded")

This sets the Default Profile of chrome wich is the one i use while i run Chromedriver.....

  • Hi, so if manually login to page that have a captcha, then use selenium with this code... I get bypassed login? – itajackass Apr 07 '20 at 06:45