selenium登录4399
程序员文章站
2022-03-07 17:13:36
```Python
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from se... ......
from selenium import webdriver from selenium.webdriver.support.wait import webdriverwait from selenium.webdriver.common.by import by from selenium.webdriver.support import expected_conditions as ec username = '' # 输入你的4399账号 password = '' # 输入你的4399密码 driver = webdriver.chrome() wait = webdriverwait(driver, 10) driver.get('http://www.4399.com/') # 找到登录入口,并点击 wait.until(ec.element_to_be_clickable((by.css_selector, '#login_tologin'))).click() # 切入frame driver.switch_to.frame('popup_login_frame') # 找到输入框,输入账号密码 wait.until(ec.presence_of_element_located((by.css_selector, '#username'))).send_keys('username') wait.until(ec.presence_of_element_located((by.css_selector, '#password'))).send_keys('password') # 点击登录按钮 wait.until(ec.element_to_be_clickable((by.css_selector, '#login_form > fieldset > div.login_hor.ux_login.clearfix > input'))).click()
上一篇: python中int与str互转
下一篇: CSS3实现扇形动画菜单特效