Selenium 报错之elenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to lo

运行selenium报错如下:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"id","selector":"//*[@id='txt_userName']"}
  (Session info: chrome=70.0.3538.77)
  (Driver info: chromedriver=70.0.3538.67 (9ab0cfab84ded083718d3a4ff830726efd38869f),platform=Windows NT 6.1.7601 SP1 x86_64)
 

Selenium 报错之elenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to lo

原因分析:

  chrome的版本和Chromedriver的版本不匹配导致。可通过版本匹配解决。