1
我一直在使用Python腳本和Selenium庫登錄Linkedin幾個月。在過去一週內,它不再有效。使用Selenium登錄到網站停止工作
我不知道是怎麼回事。似乎Linkedin沒有重新命名任何字段。
這裏是我的代碼片段:
#define URL and launch firefox
mainURL='https://www.linkedin.com/'
browser=webdriver.Firefox()
browser.get(mainURL)
time.sleep(5)
#first log into linkedin.com
try:
emailElem = browser.find_element_by_id('login-email')
emailElem.send_keys('username')
except:
print('Was not able to find an element with the login-email id name.')
try:
passwordElem=browser.find_element_by_id('login-password')
passwordElem.send_keys('password')
passwordElem.submit()
except:
print('Was not able to find an element with the login-password id name.')
time.sleep(5)
任何幫助,將不勝感激,因爲我是一個新手的編碼和無法弄清楚發生了什麼變化。
分享異常日誌 – Andersson
你應該添加輸出日誌太 – ProFan
@Andersson這裏是什麼,是說:ERROR:根:消息 ... 提高exception_class(消息,屏幕,堆棧跟蹤) selenium.common.exceptions.WebDriverException :消息:期望[對象未定義]未定義爲字符串 – user3003374