selenium firebug firePath xpath问题
一、安裝
1.Win下cmd 輸入pip install selenium
注:現(xiàn)在默認(rèn)安裝的應(yīng)該都是3.141.0版本
2.pycharm下安裝
進(jìn)入文件>>設(shè)置>>項(xiàng)目>>project interpreter>>按右上角加號(hào)
搜索輸入selenium,點(diǎn)擊安裝即可
二、瀏覽器的使用
1.火狐
(1)安裝
http://ftp.mozilla.org/pub/mozilla.org//firefox/releases/
我下載的是最新版本firefox.66
(2)用火狐這里還需要安裝對(duì)應(yīng)webdriver
https://github.com/mozilla/geckodriver/releases/
(3)安裝
https://www.chromedownloads.net/chrome64win/
(4)測(cè)試
運(yùn)行看能否打開(kāi)百度頁(yè)面
2.我下載的也是最新版本chrome.72
和火狐一樣安裝對(duì)應(yīng)webdriver
https://sites.google.com/a/chromium.org/chromedriver/ 或者
http://chromedriver.storage.googleapis.com/index.html
3.其他就不做說(shuō)明了,都類似
4.webdriver安裝路徑(重點(diǎn)說(shuō)明)
Win:復(fù)制webdriver到Python安裝目錄下
Mac:復(fù)制webdriver到/usr/local/bin目錄下
5.Webdriver版本選者(其他瀏覽器類似)
6.使用Selenium一般都需要獲取xpath,但是現(xiàn)在如火狐都不支持firepath了
那怎么獲取呢?
很簡(jiǎn)單 f12 >>選中代碼右鍵>>copy>>選xpath
其他瀏覽器也類似
總結(jié)
以上是生活随笔為你收集整理的selenium firebug firePath xpath问题的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: [译]Selenium —— 怎样使用F
- 下一篇: Selenium2+python自动化6