![](/img/trans.png)
[英]Intellisense not working for selenium in vs code with python
[英]How can I use Intellisense for Selenium on VS Code?
我無法在 VSCODE 上對 Selenium 使用 Intellisense 或高亮顯示。 例如,鍵入時不提供“send_keys”命令或“driver.find_element_by_xpath”不是彩色的。 我已經安裝了 Python 擴展並尋找 Selenium 擴展,但沒有找到任何東西。
這是我的設置。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": ""
}
目前看來VS Code不支持提示“sent_keys()”; 至於“driver.find_element_by_xpath”的顏色顯示,你可以嘗試不同的主題擴展,會顯示colors,例如,“Tokyo Hack”,“SynthWave'84”。
您可以嘗試使用 Kite AI。 它將幫助您自動完成所有 Selenium 關鍵字
首先安裝風箏引擎。
然后從 VS Code 安裝 Kite 擴展。
我知道這已經晚了,但你可以使用類型提示來做到這一點
from selenium.webdriver.remote.webdriver import WebDriver
driver:WebDriver = webdriver.Chrome()
現在輸入“驅動程序”。 將為您提供所有方法和屬性的列表
對於元素,使用類型 WebElement
(從 selenium.webdriver.remote.webelement 導入 WebElement)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.