【PyCharm编辑器】之引用selenium包提示错误:Unresolved reference 'selenium' less... (Ctrl+F1)
一.现象还原:
当新建.py文件时,需要引用selenium中的方法时,报错,提示红波浪线:
Unresolved reference 'selenium' less... (Ctrl+F1)
This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items.
二.解决办法:
1.点击编辑器“File”->点击“settings”
2.在“settings”中,选择“Project:Pytest”->“Project Structre”->点击“Add Content Root”
3.找到安装selenium的路径,红色字体(例:F:\软件\python3.6.1\Lib\site-packages),最后点击【OK】
4.选择selenium包的路径,再点击“Sources”
5.最后再“Apply”应用,再返回.py文件中就不会再提示错误了。
不积跬步,无以致千里;不集小流,无以成江海。
如转载本文,请还多关注一下我的博客:https://www.cnblogs.com/Owen-ET/;
我的Github地址:https://github.com/Owen-ET————————————
无善无恶心之体, 有善有恶意之动, 知善知恶是良知, 为善去恶是格物。