roborframework操作selenium--mac環境
mac環境,roborframework操作selenium
1.安裝selenium模塊
sudo pip install -t /usr/local/lib/python2.7/site-packages/ selenium --指定目錄安裝
2.安裝selenium2library模塊
sudo pip install -t /usr/local/lib/python2.7/site-packages/ robotframework-selenium2library
3.查看是否安裝成功
cd /usr/local/lib/python2.7/site-packages/
selenium模塊對應:selenium和 selenium-3.4.1.dist-info
selenium2library模塊對應Selenium2Library
4.下載瀏覽器驅動:
chromedriver 2.29----對應-----chrome版本是:v56~v58(我的chrome版本是58)
selenium3.0以上的版本需要下載geckodriver驅動
6.把下載的驅動加載path路徑。因是mac系統,直接復制到 /usr/local/bin
cp /Users/username/Desktop/dev/geckodriver /usr/local/bin (不操作這步,運行case提示打不開瀏覽器)
cp /Users/username/Desktop/dev/chromdriver2.29/chromedriver /usr/local/bin
準備環境都OK,就可以編寫代碼了~~~·
4.打開ride.py,開始編輯腳本
1)新增suite,導入Selenium2Library
2)新增case,編輯腳本:
Open Browser https://www.baidu.com/ chrome ----chrome打開百度
3)運行
備:下載各chromedriver版本 http://chromedriver.storage.googleapis.com/index.html
關系表:http://blog.csdn.net/huilan_same/article/details/51896672 1、)
roborframework操作selenium--mac環境