Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23247

Unable to login using chrome profile

$
0
0

I am trying to use the chrome profile to login automatically into the facebook or any other credential site.But for some reason i am not able to login into the site.

let me share the code first,

    def setup():        try:            log.info("setting profile")            driver, action = setupWebdriver(profile_path="/home/name/.config/google-chrome",profile_name="Profile 12")            time.sleep(5)            driver.get("https://www.facebook.com/")        except Exception as e:            log.error(e)        return driver,action
def setupWebdriver(profile_path=None,profile_name=None):'''Set up Selenium Webdriver'''    chrome_options = Options()    if profile_path is not None:        chrome_options.add_argument(f'--user-data-dir={profile_path}')        chrome_options.add_argument(f"profile-directory={profile_name}")        chrome_options.add_argument("--start-maximized")        # chrome_options.add_argument("--headless") #For AWS/GCP        driver=webdriver.Chrome(options=chrome_options)#, executable_path=r"C:\Users\agney\Desktop\chromedriver-win32\chromedriver.exe")        driver.maximize_window()        action = ActionChains(driver)    else:        chrome_options.add_argument("--headless") #For AWS/GCP/        chrome_options.add_argument("enable-automation")        chrome_options.add_argument("--window-size=1920,1080")        chrome_options.add_argument("--start-maximized")        chrome_options.add_argument("--no-sandbox")        chrome_options.add_argument("--disable-extensions")        chrome_options.add_argument("--dns-prefetch-disable")        chrome_options.add_argument("--disable-gpu")        driver=webdriver.Chrome(options=chrome_options)#, executable_path=r"C:\Users\agney\Desktop\chromedriver-win32\chromedriver.exe")        driver.delete_all_cookies()        driver.maximize_window()        action = ActionChains(driver)    return driver,action

When i run it,i am able to open a chrome browser with the account as shown below in picture,you could see the profile name "fb" at the top right.

enter image description here

But when i try to login to some website other than facebook through it,it just won't login into there.I check the saved password in the browser that selenium opened,there is no password but when i did same by manually opening the same profile and check saved cred they are there in the browser as saved.

I have checked the path and all and they're correct.

browser version : 120.0.6099.216


Viewing all articles
Browse latest Browse all 23247

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>