因为工作,我需要学习自动化测试,在使用selenium时出现了bug,废话不多说,先贴报错信息
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot get automat
定位错误代码行
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot get automat
这句代码是chromedriver使浏览器最大化

之所以报错是因为chromedriver版本太旧了

首先查看你的Chrome浏览器版本

Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot get automat

可以通过https://npm.taobao.org/mirrors/chromedriver/ 这个网址查看chromedriver与对应的Chrome版本
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot get automat
然后下载对应的chromedriver就可以了
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot get automat
解压后放到项目中
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot get automat
运行发现没有报错
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot get automat

相关文章:

  • 2021-05-27
  • 2022-12-23
  • 2021-06-29
  • 2021-11-29
  • 2021-10-14
  • 2021-04-22
  • 2021-09-09
  • 2021-11-08
猜你喜欢
  • 2022-01-21
  • 2021-09-11
  • 2021-09-06
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案