A test case for automating login authentication on the website without having to enter the login details in python

13 views Asked by At

I want a python script that automates authentication of a login page without testing the credentials for vulnerable users.

I tried to use the following code to reuse the cookies for the next authentication without having to enter username and password.

from selenium import webdriver
from csv import DictReader

driver = webdriver.Chrome()
driver.get('https://facebook.com')

def get_cookies_values(file):

    with open(file,encoding='utf-8-sig')as f:
        dict_reader = DictReader(f)
        list_of_dicts = list(dict_reader)
    return list_of_dicts
    
    
cookies = get_cookies_values("cookies.csv")

for i in cookies:
    driver.add_cookie(i)

driver.refresh()

But the above code is not doing what is required for me. what I want is that I can log into the site without the credentials to check for vulnerabilities.

0

There are 0 answers