from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
driver = webdriver.Chrome() #Opens the chromedriver. If u don't have a chromedriver, u can download it from https://chromedriver.chromium.org/downloads
driver.get('Url of the banking website') #Opens the specified url
bank_id = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, 'Textbox xpath'))) #Finds the bank_id textbox
bank_id.click() #Clicks it
bank_id.send_keys('Your username') #Enters ur username in the textbox
pswrd = driver.find_element_by_xpath('Xpath of textbox') #Does the same for the password.
pswrd.click()
pswrd.send_keys('Your password')
login_btn = driver.find_element_by_xpath('Xpath of submit button') #Finds the login button
login_btn.click() #Clicks the login button
最好的方法是使用
selenium
。以下是您如何使用selenium:就这样!您已登录该网站!希望这有帮助
相关问题 更多 >
编程相关推荐