TA的每日心情 | 无聊 4 天前 |
---|
签到天数: 530 天 连续签到: 2 天 [LV.9]测试副司令
|
1测试积点
问题:
selenium 定位不到元素
- <font face="微软雅黑" size="3">
- from selenium import webdriver
- from selenium.webdriver.support.ui import WebDriverWait
- import time
- path = r'C:\Users\hzhb\AppData\Roaming\Mozilla\Firefox\Profiles\0sxz7ow0.default'
- profile = webdriver.FirefoxProfile(path)
- b = webdriver.Firefox(profile)
- b.get('http://pan.baidu.com')
- time.sleep(5)
- user_pwd_login = WebDriverWait(b, 5, 0.5).until(lambda x: x.find_element_by_id('TANGRAM__PSP_4__footerULoginBtn'))
- user_pwd_login.click()
- username = WebDriverWait(b, 5, 0.5).until(lambda x: x.find_element_by_name('pass-text-input pass-text-input-userName'))
- username.send_keys('18716008303')
- pwd = WebDriverWait(b, 5, 0.5).until(lambda x: x.find_element_by_name('pass-text-input pass-text-input-password'))
- username.send_keys('1739947940zz')
- b.find_element_by_id('TANGRAM__PSP_4__submit').click()
- time.sleep(5)
- cookie = b.get_cookies()
- print cookie
- b.quit()</font>
复制代码
|
|