python - 导入库 'SeleniumLibrary' 失败 : ModuleNotFoundError: No module named 'SeleniumLibrary' In VS Code

标签 python selenium visual-studio-code robotframework

问题在 VS Code 中重复出现

Error in file 'd:File Location' on line 2: Importing library 'SeleniumLibrary' failed: ModuleNotFoundError: No module named 'SeleniumLibrary'
Traceback (most recent call last):
  None
PYTHONPATH:
  c:\Users\Username\.vscode\extensions\robocorp.robotframework-lsp-0.35.0\src\robotframework_debug_adapter
  D:\Vector.ai\qa-automation-ui
  c:\Users\Username\.vscode\extensions\robocorp.robotframework-lsp-0.35.0\src
  c:\Users\Username\.vscode\extensions\robocorp.robotframework-lsp-0.35.0\src\robotframework_ls\vendored
  C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\python38.zip
  C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\DLLs
  C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\lib
  C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063
  C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\lib\site-packages
[ ERROR ] Error in file 'd:\Vector.ai\qa-automation-ui\KeyWords.robot' on line 2: Importing library 'SeleniumLibrary' failed: ModuleNotFoundError: No module named 'SeleniumLibrary'
Traceback (most recent call last):
  None
PYTHONPATH:
  c:\Users\Username\.vscode\extensions\robocorp.robotframework-lsp-0.35.0\src\robotframework_debug_adapter
  D:\Vector.ai\qa-automation-ui
  c:\Users\Username\.vscode\extensions\robocorp.robotframework-lsp-0.35.0\src
  c:\Users\Username\.vscode\extensions\robocorp.robotframework-lsp-0.35.0\src\robotframework_ls\vendored
  C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\python38.zip
  C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\DLLs
  C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\lib
  C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063
  C:\Users\Username\AppData\Local\robocorp\holotree\b1f3c244e_9679c063\lib\site-packages

最佳答案

首先应该在命令提示符下运行此命令以在系统中安装seleniumlibrary:

pip install robotframework-seleniumlibrary

然后,您需要在 Visual Studio Code 中配置 Robocorp Code 和 Robot Framework Language Server 扩展 Python 路径,然后重新启动 Visual Studio Code,然后执行您的程序.

请引用官方文档:https://pypi.org/project/robotframework-seleniumlibrary

关于python - 导入库 'SeleniumLibrary' 失败 : ModuleNotFoundError: No module named 'SeleniumLibrary' In VS Code,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70518196/

相关文章:

java - 如何从包中排除一些 Selenium 测试用例?

python - VS Code/Pylance/Pylint 无法解析导入

python - 为什么我的代码会产生 TypeError : 'NoneType' object is not iterable

python - 如何使用 pandas 库对 python 中的浮点值进行分类

RSelenium findElement 适用于 firefox :2. 53.1 但不适用于 firefox:latest

typescript - Prettier 没有按规定缩进

typescript - Visual Studio 2019 : Not showing Typescript Intellisence

python - python 会为代理提供足够的性能吗?

Python 3 如何从标准输入上的文件生成 md5 哈希?

c# - WebDriverWait 没有在等待我指定的元素