TA的每日心情 | 无聊 昨天 09:47 |
---|
签到天数: 528 天 连续签到: 1 天 [LV.9]测试副司令
|
1测试积点
EC中没有url_contains方法,而且url开头的方法都没有。是怎么回事?
- from selenium import webdriver
- from selenium.webdriver.support import expected_conditions as EC
- from selenium.webdriver.support.ui import WebDriverWait
- driver = webdriver.Chrome(executable_path="D:\chromedriver\chromedriver.exe")
- class TrainSpider(object):
- login_url = "https://kyfw.12306.cn/otn/resources/login.html"
- personal_url = "https://kyfw.12306.cn/otn/view/index.html"
- def __init__(self,from_station,to_station,train_date):
- self.from_station = from_station
- self.to_station = to_station
- self.train_date = train_date
- def login(self):
- driver.get(self.login_url)
- WebDriverWait(driver,1000).until(
- EC.u
- )
- print("登录成功")
- def run(self):
- self.login()
- def main():
- spider = TrainSpider("北京","上海","2021-11-23")
- spider.run()
- if __name__ == '__main__':
- main()
-
复制代码
|
|