[英]How can I use Intellisense for Selenium on VS Code?
I cannot use Intellisense or highlightining for Selenium on VSCODE.我无法在 VSCODE 上对 Selenium 使用 Intellisense 或高亮显示。 For example, 'send_keys' command is not offered while typing or 'driver.find_element_by_xpath' is not colorful.例如,键入时不提供“send_keys”命令或“driver.find_element_by_xpath”不是彩色的。 I have installed Python extension and looked for Selenium extension, but not found anything.我已经安装了 Python 扩展并寻找 Selenium 扩展,但没有找到任何东西。
Here is my settings.json:这是我的设置。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": ""
}
It seems that VS Code does not support prompt "sent_keys()" at present;目前看来VS Code不支持提示“sent_keys()”; As for the color display of "driver.find_element_by_xpath", you could try different theme extensions, which will display colors, for example,"Tokyo Hack","SynthWave'84".至于“driver.find_element_by_xpath”的颜色显示,你可以尝试不同的主题扩展,会显示colors,例如,“Tokyo Hack”,“SynthWave'84”。
You can try using Kite AI.您可以尝试使用 Kite AI。 It will help you autocomplete all the Selenium keywords它将帮助您自动完成所有 Selenium 关键字
First install the Kite engine .首先安装风筝引擎。
Then install Kite extension from VS Code.然后从 VS Code 安装 Kite 扩展。
I know this is late but you could use type hinting to do that我知道这已经晚了,但你可以使用类型提示来做到这一点
from selenium.webdriver.remote.webdriver import WebDriver
driver:WebDriver = webdriver.Chrome()
now typing "driver."现在输入“驱动程序”。 will give you a list of all the methods and attributes将为您提供所有方法和属性的列表
for elements, use the type WebElement对于元素,使用类型 WebElement
(from selenium.webdriver.remote.webelement import WebElement) (从 selenium.webdriver.remote.webelement 导入 WebElement)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.