#-*- coding: GB2312 -*-
#上面这一行是解决输入文本框中的问题
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import time
browser = webdriver.Firefox() # Get local session of firefox
browser.get("http://XXXX.XXXX.com") # Load page
time.sleep(0.2)
username=browser.find_element_by_id("XXXX");
passwd=browser.find_element_by_id("XXXX");
submit=browser.find_element_by_id("XXXX")
username.send_keys("XXXX")
passwd.send_keys("XXXX")
time.sleep(0.2) # Let the page load, will be added to the API
submit.click()
print("Login Success!")
time.sleep(2)
时间: 2024-10-11 21:33:54