个人技术分享

pip的安装
    新建一个txt
    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    把上面的代码复制进去后,把后缀名改为.bat然后双击运行

     当前目录会出现一个这个文件

          

        然后在命令行pyhon get-pip.py等它下好就可以了
selenium安装
    需要安装到工程目录下,可以直接在pycharm打开终端
    pip install selenium这样才能import,在其它地方安装,import是不行的
webdirver的安装
    下载链接
    https://googlechromelabs.github.io/chrome-for-testing/
    看清楚是chromedirver不是chrome再下
    diver的历史版本 :https://chromedriver.storage.googleapis.com/index.html
    
    下载后解压有一个chromediver.exe的文件,把它复制到chrome.exe所在的目录下
写demo测试
    在pycharm中新建一个test.py的文件,输入以下代码:
    

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

wd = webdriver.Chrome()
wd.get('https://www.baidu.com')

    可以成功打开浏览器跳转到百度首页就算成功(浏览器会自动关闭没问题)

参考文档:https://www.byhy.net/auto/selenium/01/
b站学习视频:https://www.bilibili.com/video/BV1Z4411o7TA/?p=4&spm_id_from=pageDriver&vd_source=9011454fd1a10236b01d23c81676c2bd