[Python] Unable to login to website in Chrome using Selenium Webdriver in Python

Discussão em 'Python' iniciado por Stack, Dezembro 22, 2024.

  1. Stack

    Stack Membro Participativo

    I am using Selenium module in Python to login to the website www.value,researchonline.com..

    I am able to click the button that says 'login with password' and then execute the code to input the username. But when i click on the 'Submit' button, it gives an error "Unable to process your request. Please try again.". I believe this is due to the website blocking automated script for login. Code is pasted below.

    from selenium import webdriver
    from selenium.webdriver.common.by import By
    from selenium.webdriver.common.keys import Keys
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    import time
    import pandas as pd
    import requests
    from bs4 import BeautifulSoup

    # Set up the Chrome WebDriver
    driver = webdriver.Chrome()

    url = "https://www.valueresearchonline.com/login/?site-code=VROL&target=%2F&utm_source=home&utm_medium=vro&utm_campaign=desktop-profile-menu/"
    driver.get(url)
    driver.implicitly_wait(5)

    # Click the button 'Login with password' (step 1)
    login_button1 = driver.find_element(By.CSS_SELECTOR, "button[data-user='Log in with password']")
    login_button1.click()

    # Define login credentials
    username = 'abc@gmail.com'
    # Find the username input field and submit button (step 2)
    username_field = driver.find_element(By.NAME, 'username')
    # Enter the username into the field
    username_field.send_keys(username)

    login_button2 = driver.find_element(By.CSS_SELECTOR, "button[id='proceed-btn']")
    # Submit the username to go to the password page
    login_button2.click()


    I have checked some related threads on stackoverflow, but most of them didn't have a solution or the proposed solution didn't work for me. Please advise if there is any workaround.

    Thanks for the help.

    Continue reading...

Compartilhe esta Página