简体   繁体   中英

how can I save password(login info) using selenium , so I have to not login again and again on Instagram

my project

I am working on a project in which I have login on Instagram again and again , and after a limited number of login . I can not no more login for a day.

my problem

is there any way I can save login information and do not have login every time .

My research

I found some solution but its in java , and do not know java so well ,I want in solution in python - I found solution in java

my browser - Firefox

python - latest

selenium - latest

instead of inspecting the element you can use an extension called Katalon Recorder which will usually 100% get the xpath of the thing you are trying to interact with. for example: you cannot inspect the favorites bar, but using Katalon Recorder you can fetch the xpath, its also good for more efficient selenium coding

I found the solution:

you need to add profile to add argument you can do this either by making a new profile of chrome or add existing

steps of solution in python

  1. make a new folder for chrome profile or u can go to
    example of my path - "C:\\Users\\saksh\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 3" and take existing path of chrome profile

2.this the code of python which u have to add

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=" +add ur folder path either new folder or existing profile+ ")
browser = webdriver.Chrome(options =  options , executable_path = "ur chrome driver path" )
  1. if u made a new folder the first time u have to login and save password.

THANKS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM