首页 > 解决方案 > 如何在 VS Code 上将 Intellisense 用于 Selenium?

问题描述

我不能在 VSCODE 上对 Selenium 使用 Intellisense 或高亮显示。例如,键入时不提供“send_keys”命令,或者“driver.find_element_by_xpath”不是彩色的。我已经安装了 Python 扩展并寻找 Selenium 扩展,但没有找到任何东西。

在此处输入图像描述

这是我的settings.json:

  {
    "editor.suggestSelection": "first",
    "python.languageServer": "Microsoft",
    "python.pythonPath": "/usr/local/opt/python/bin/python3.7",
    "editor.fontSize": 14,
    "python.linting.pylintEnabled": true,
    "python.linting.enabled": true,
    "python.linting.flake8Enabled": false,
    "python.autoComplete.extraPaths": [
        
    ],
    "java.semanticHighlighting.enabled": true,
    "vsintellicode.modelDownloadPath": ""
}

标签: pythonseleniumvisual-studio-codeautocompletesyntax-highlighting

解决方案


目前看来VS Code不支持提示“sent_keys()”;至于“driver.find_element_by_xpath”的颜色显示,您可以尝试不同的主题扩展,它们会显示颜色,例如“Tokyo Hack”、“SynthWave'84”。


推荐阅读