vsc、python與selenium開(kāi)發(fā)環(huán)境搭建

1、下載python,配置環(huán)境變量


2、安裝pip :https://pypi.python.org/pypi/pip,進(jìn)入目錄 python setup.py insall,配置環(huán)境變量

3、安裝selenium: pip install -U selenium

4、安裝webdriver,配置chome目錄環(huán)境變量,并放在此目錄下python


http://blog.csdn.net/cz9025/article/details/70160273

瀏覽器與webdriver版本對(duì)應(yīng)即可

http://npm.taobao.org/mirrors/chromedriver


5、vscode中task.json配置如下

{

? ? "version": "0.1.0",

? ? "command": "python",

? ? "isShellCommand": true,

? ? "args": ["${file}"],

? ? "showOutput": "always"

}




lanuch.json配置

{

? ? "version": "0.2.0",

? ? "configurations": [

? ? ? ? {

? ? ? ? ? ? "name": "Python",

? ? ? ? ? ? "type": "python",

? ? ? ? ? ? "request": "launch",

? ? ? ? ? ? "stopOnEntry": true,

? ? ? ? ? ? "pythonPath": "${config:python.pythonPath}",

? ? ? ? ? ? "program": "${file}",

? ? ? ? ? ? "cwd": "${workspaceRoot}",

? ? ? ? ? ? "env": {},

? ? ? ? ? ? "envFile": "${workspaceRoot}/.env",

? ? ? ? ? ? "debugOptions": [

? ? ? ? ? ? ? ? "WaitOnAbnormalExit",

? ? ? ? ? ? ? ? "WaitOnNormalExit",

? ? ? ? ? ? ? ? "RedirectOutput"

? ? ? ? ? ? ]

? ? ? ? },

? ? ? ? {

? ? ? ? ? ? "name": "PySpark",

? ? ? ? ? ? "type": "python",

? ? ? ? ? ? "request": "launch",

? ? ? ? ? ? "stopOnEntry": true,

? ? ? ? ? ? "osx": {

? ? ? ? ? ? ? ? "pythonPath": "${env:SPARK_HOME}/bin/spark-submit"

? ? ? ? ? ? },

? ? ? ? ? ? "windows": {

? ? ? ? ? ? ? ? "pythonPath": "${env:SPARK_HOME}/bin/spark-submit.cmd"

? ? ? ? ? ? },

? ? ? ? ? ? "linux": {

? ? ? ? ? ? ? ? "pythonPath": "${env:SPARK_HOME}/bin/spark-submit"

? ? ? ? ? ? },

? ? ? ? ? ? "program": "${file}",

? ? ? ? ? ? "cwd": "${workspaceRoot}",

? ? ? ? ? ? "env": {},

? ? ? ? ? ? "envFile": "${workspaceRoot}/.env",

? ? ? ? ? ? "debugOptions": [

? ? ? ? ? ? ? ? "WaitOnAbnormalExit",

? ? ? ? ? ? ? ? "WaitOnNormalExit",

? ? ? ? ? ? ? ? "RedirectOutput"

? ? ? ? ? ? ]

? ? ? ? },

? ? ? ? {

? ? ? ? ? ? "name": "Python Module",

? ? ? ? ? ? "type": "python",

? ? ? ? ? ? "request": "launch",

? ? ? ? ? ? "stopOnEntry": true,

? ? ? ? ? ? "pythonPath": "${config:python.pythonPath}",

? ? ? ? ? ? "module": "module.name",

? ? ? ? ? ? "cwd": "${workspaceRoot}",

? ? ? ? ? ? "env": {},

? ? ? ? ? ? "envFile": "${workspaceRoot}/.env",

? ? ? ? ? ? "debugOptions": [

? ? ? ? ? ? ? ? "WaitOnAbnormalExit",

? ? ? ? ? ? ? ? "WaitOnNormalExit",

? ? ? ? ? ? ? ? "RedirectOutput"

? ? ? ? ? ? ]

? ? ? ? },

? ? ? ? {

? ? ? ? ? ? "name": "Integrated Terminal/Console",

? ? ? ? ? ? "type": "python",

? ? ? ? ? ? "request": "launch",

? ? ? ? ? ? "stopOnEntry": true,

? ? ? ? ? ? "pythonPath": "${config:python.pythonPath}",

? ? ? ? ? ? "program": "${file}",

? ? ? ? ? ? "cwd": "",

? ? ? ? ? ? "console": "integratedTerminal",

? ? ? ? ? ? "env": {},

? ? ? ? ? ? "envFile": "${workspaceRoot}/.env",

? ? ? ? ? ? "debugOptions": [

? ? ? ? ? ? ? ? "WaitOnAbnormalExit",

? ? ? ? ? ? ? ? "WaitOnNormalExit"

? ? ? ? ? ? ]

? ? ? ? },

? ? ? ? {

? ? ? ? ? ? "name": "External Terminal/Console",

? ? ? ? ? ? "type": "python",

? ? ? ? ? ? "request": "launch",

? ? ? ? ? ? "stopOnEntry": true,

? ? ? ? ? ? "pythonPath": "${config:python.pythonPath}",

? ? ? ? ? ? "program": "${file}",

? ? ? ? ? ? "cwd": "${workspaceRoot}",

? ? ? ? ? ? "console": "externalTerminal",

? ? ? ? ? ? "env": {},

? ? ? ? ? ? "envFile": "${workspaceRoot}/.env",

? ? ? ? ? ? "debugOptions": [

? ? ? ? ? ? ? ? "WaitOnAbnormalExit",

? ? ? ? ? ? ? ? "WaitOnNormalExit"

? ? ? ? ? ? ]

? ? ? ? },

? ? ? ? {

? ? ? ? ? ? "name": "Django",

? ? ? ? ? ? "type": "python",

? ? ? ? ? ? "request": "launch",

? ? ? ? ? ? "stopOnEntry": true,

? ? ? ? ? ? "pythonPath": "${config:python.pythonPath}",

? ? ? ? ? ? "program": "${workspaceRoot}/manage.py",

? ? ? ? ? ? "cwd": "${workspaceRoot}",

? ? ? ? ? ? "args": [

? ? ? ? ? ? ? ? "runserver",

? ? ? ? ? ? ? ? "--noreload",

? ? ? ? ? ? ? ? "--nothreading"

? ? ? ? ? ? ],

? ? ? ? ? ? "env": {},

? ? ? ? ? ? "envFile": "${workspaceRoot}/.env",

? ? ? ? ? ? "debugOptions": [

? ? ? ? ? ? ? ? "WaitOnAbnormalExit",

? ? ? ? ? ? ? ? "WaitOnNormalExit",

? ? ? ? ? ? ? ? "RedirectOutput",

? ? ? ? ? ? ? ? "DjangoDebugging"

? ? ? ? ? ? ]

? ? ? ? },

? ? ? ? {

? ? ? ? ? ? "name": "Flask",

? ? ? ? ? ? "type": "python",

? ? ? ? ? ? "request": "launch",

? ? ? ? ? ? "stopOnEntry": false,

? ? ? ? ? ? "pythonPath": "${config:python.pythonPath}",

? ? ? ? ? ? "program": "fully qualified path fo 'flask' executable. Generally located along with python interpreter",

? ? ? ? ? ? "cwd": "${workspaceRoot}",

? ? ? ? ? ? "env": {

? ? ? ? ? ? ? ? "FLASK_APP": "${workspaceRoot}/quickstart/app.py"

? ? ? ? ? ? },

? ? ? ? ? ? "args": [

? ? ? ? ? ? ? ? "run",

? ? ? ? ? ? ? ? "--no-debugger",

? ? ? ? ? ? ? ? "--no-reload"

? ? ? ? ? ? ],

? ? ? ? ? ? "envFile": "${workspaceRoot}/.env",

? ? ? ? ? ? "debugOptions": [

? ? ? ? ? ? ? ? "WaitOnAbnormalExit",

? ? ? ? ? ? ? ? "WaitOnNormalExit",

? ? ? ? ? ? ? ? "RedirectOutput"

? ? ? ? ? ? ]

? ? ? ? },

? ? ? ? {

? ? ? ? ? ? "name": "Flask (old)",

? ? ? ? ? ? "type": "python",

? ? ? ? ? ? "request": "launch",

? ? ? ? ? ? "stopOnEntry": false,

? ? ? ? ? ? "pythonPath": "${config:python.pythonPath}",

? ? ? ? ? ? "program": "${workspaceRoot}/run.py",

? ? ? ? ? ? "cwd": "${workspaceRoot}",

? ? ? ? ? ? "args": [],

? ? ? ? ? ? "env": {},

? ? ? ? ? ? "envFile": "${workspaceRoot}/.env",

? ? ? ? ? ? "debugOptions": [

? ? ? ? ? ? ? ? "WaitOnAbnormalExit",

? ? ? ? ? ? ? ? "WaitOnNormalExit",

? ? ? ? ? ? ? ? "RedirectOutput"

? ? ? ? ? ? ]

? ? ? ? },

? ? ? ? {

? ? ? ? ? ? "name": "Pyramid",

? ? ? ? ? ? "type": "python",

? ? ? ? ? ? "request": "launch",

? ? ? ? ? ? "stopOnEntry": true,

? ? ? ? ? ? "pythonPath": "${config:python.pythonPath}",

? ? ? ? ? ? "cwd": "${workspaceRoot}",

? ? ? ? ? ? "env": {},

? ? ? ? ? ? "envFile": "${workspaceRoot}/.env",

? ? ? ? ? ? "args": [

? ? ? ? ? ? ? ? "${workspaceRoot}/development.ini"

? ? ? ? ? ? ],

? ? ? ? ? ? "debugOptions": [

? ? ? ? ? ? ? ? "WaitOnAbnormalExit",

? ? ? ? ? ? ? ? "WaitOnNormalExit",

? ? ? ? ? ? ? ? "RedirectOutput",

? ? ? ? ? ? ? ? "Pyramid"

? ? ? ? ? ? ]

? ? ? ? },

? ? ? ? {

? ? ? ? ? ? "name": "Watson",

? ? ? ? ? ? "type": "python",

? ? ? ? ? ? "request": "launch",

? ? ? ? ? ? "stopOnEntry": true,

? ? ? ? ? ? "pythonPath": "${config:python.pythonPath}",

? ? ? ? ? ? "program": "${workspaceRoot}/console.py",

? ? ? ? ? ? "cwd": "${workspaceRoot}",

? ? ? ? ? ? "args": [

? ? ? ? ? ? ? ? "dev",

? ? ? ? ? ? ? ? "runserver",

? ? ? ? ? ? ? ? "--noreload=True"

? ? ? ? ? ? ],

? ? ? ? ? ? "env": {},

? ? ? ? ? ? "envFile": "${workspaceRoot}/.env",

? ? ? ? ? ? "debugOptions": [

? ? ? ? ? ? ? ? "WaitOnAbnormalExit",

? ? ? ? ? ? ? ? "WaitOnNormalExit",

? ? ? ? ? ? ? ? "RedirectOutput"

? ? ? ? ? ? ]

? ? ? ? },

? ? ? ? {

? ? ? ? ? ? "name": "Attach (Remote Debug)",

? ? ? ? ? ? "type": "python",

? ? ? ? ? ? "request": "attach",

? ? ? ? ? ? "localRoot": "${workspaceRoot}",

? ? ? ? ? ? "remoteRoot": "${workspaceRoot}",

? ? ? ? ? ? "port": 3000,

? ? ? ? ? ? "secret": "my_secret",

? ? ? ? ? ? "host": "localhost"

? ? ? ? }

? ? ]

}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容