问题:
selenium.common.exceptions.SessionNotCreatedException: Message: session not created
原因:
selenium模拟的客户端对浏览器的操作,相应浏览器的驱动版本不一致导致的。
解决方法:
第一步,查看自己chrome浏览器的版本,输入网址chrome://version/
,如下图:
![在这里插入图片描述](https://img-blog.csdnimg.cn/92ba4c8c1bb44d83ae15790da1a72711.png)
第二步,下载对应版本的chrome浏览器驱动,跳转http://chromedriver.storage.googleapis.com/index.html
这里我的chrome浏览器版本为101.0.4951,所以选择101.0.4951,如下图:
![在这里插入图片描述](https://img-blog.csdnimg.cn/869317d396c744baa9c27e264c727c34.png)
按照自己的实际情况选择下载,我的是window系统,选择win32,如下图:
![在这里插入图片描述](https://img-blog.csdnimg.cn/af40c23f1c7646d5b25f08cd9993cafb.png)
第三步,把下载下来的驱动放到chrome浏览器的安装包路径和Python安装包路径下,如下图:
![在这里插入图片描述](https://img-blog.csdnimg.cn/81e5c79679ee49f9ae82a5b25954d4db.png)
![在这里插入图片描述](https://img-blog.csdnimg.cn/fe93236c3f86467f9959a7738b773562.png)
最后,重启PyCharm Community Edition 2022.1,问题解决了。