Can we run selenium in our current account logged- in browser?

5.7k views Asked by At

Can we run selenium in our current account logged in browser ?

Basically if i try logging into google using selenium , its says browser insecure.

i am trying to make a amazon cart auto checkout as a school project

so if i try in my existing browser , my amazon id is already registered and i dont have to sign in again . but if i use amazon login in selenium its asking for signin and 2fa is being sent to my mail id, how to i skip this step and directly go to the logged in page??

please help

2

There are 2 answers

1
BillyZee On

You can't use your non-chrome driver browser (aka regular chrome browser). Selenium only works with chrome-drivers. One way remain signed in is to specify a profile in options so that every-time the driver initiates, it loads your cookies and history.

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

chrome_options = Options()
chrome_options.add_argument("--user-data-dir=Amazon")

driver = webdriver.Chrome(options=chrome_options)

From the code above, chrome_options.add_argument("--user-data-dir=Amazon") will create a profile 'Amazon' if not already there, and save cookies and history there.

enter image description here

The next time you run the driver it will load it from 'Amazon'.

0
Rajanand On

Here is a blog that explains how to install a chrome browser remotely on a specific folder by installing a dedicated browser onto it to use selenium with.

This manages all data including cache, history, accounts, etc

for further info refer the link here

Here is a blog that explains how to install a chrome browser remotely on a specific folder by installing a dedicated browser onto it to use selenium with.

This manages all data including cache, history, accounts, etc

for further info refer the link here

https://learn-automation.com/how-to-execute-selenium-scripts-on-already-opened-browser/