qdyxmas's Room

Done is better than perfect...

linux下后台运行selenium

linux下后台运行selenium:

安装浏览器:

Google Chrome 77.0.3865.75configure
ChromeDriver 77.0.3865.40

pyautogui:

安装Xvfb后启动虚拟显示器
Xvfb -ac :0 -screen 0 1920x1080x24
export DISPLAY=:0

FAQ:

Q:    NOTE: You must install tkinter on Linux to use MouseInfo. Run the following: sudo apt-get install python3-tk python3-dev
A:    python3.6安装tk/tcl:
      1.下载tcl包和tk包 https://www.tcl.tk/software/tcltk/download.html
      2.安装包https://blog.csdn.net/and_december/article/details/71178539

运行脚本

# coding:utf-8 
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument('--remote-debugging-port=9222')
browser = webdriver.Chrome(chrome_options=chrome_options)
driver.get("https://www.baidu.com")

阅读全文 »

centos7安装gdal

sudo yum install postgresql postgresql-devel

#libkml Support
##---------This part is depending on prebuilt libraries. In the future we may replace this by compiling them from source.
wget http://s3.amazonaws.com/etc-data.koordinates.com/gdal-travisci/install-libkml-r864-64bit.tar.gz
tar xzf install-libkml-r864-64bit.tar.gz

#Copy these required files to  /usr/local
sudo cp -r install-libkml/include/* /usr/local/include
sudo cp -r install-libkml/lib/* /usr/local/lib
sudo ldconfig


#download GDAL
wget http://download.osgeo.org/gdal/2.2.3/gdal-2.2.3.tar.gz

#Untar
tar xzf gdal-2.2.3.tar.gz
cd gdal-2.2.3

#Compile from source
./configure --with-libkml 
make
make install

阅读全文 »

unittest统计运行结果

runner = HTMLTestRunner.HTMLTestRunner(*****)
runResult = runner.run(suite)
passCount = runResult.success_count
errorCount = runResult.error_count
failureCount = runResult.failure_count``

阅读全文 »