yum -y install gcc automake autoconf libtool make yum -y install make* yum -y install zlib* yum -y install openssl libssl-dev下载 python
cd /usr/local/src wget https://www.python.org/ftp/python/3.8.9/Python-3.8.9.tgz tar -zxvf Python-3.8.9.tgz mv Python-3.8.9 py3.8 cd py3.8make 编译安装
./configure --prefix=/usr/local/src/py3.8 make && make install添加软链接
添加 python3 软链接
ln -s /usr/local/src/py3.8/bin/python3.8 /usr/bin/python3
添加pip3软链接
ln -s /usr/local/src/py3.8/bin/pip3 /usr/bin/pip3验证环境
[root@192 py3.8]python3 --version Python 3.8.9 [root@192 py3.8]# pip3 --version pip 20.2.3 from /usr/local/src/py3.8/lib/python3.8/site-packages/pip (python 3.8)
安装后若报错: Can't connect to HTTPS URL because the SSL module is not available问题
解决方法:解决python3.* 安装后使用 pip3出现 Can't connect to HTTPS URL because the SSL module is not available问题_Lyn&Xx-CSDN博客
chrome+chromedriver安装安装chrome
yum install https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
webdriver安装
wget https://chromedriver.storage.googleapis.com/95.0.4638.10/chromedriver_linux64.zip一个简单的selenium测试
代码如下:
from selenium import webdriver from selenium.webdriver.chrome.options import Options class Test_Web: def test_login(self): chrome_options = Options() chrome_options.add_argument('--no-sandbox') chrome_options.add_argument('--disable-dev-shm-usage') chrome_options.add_argument('--headless') wd = webdriver.Chrome(chrome_options=chrome_options,executable_path='/usr/local/src/py3.8/chromedriver') #wd = webdriver.Chrome() wd.get('https://test-portal-2.summer-ospp.ac.cn/summerTest/login') wd.find_element_by_name('username').send_keys('summer') wd.find_element_by_name('password').send_keys('Aa123456') wd.find_element_by_id('btnSubmit').click() assert 1==1
运行命令及其结果如下
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)