close

# 安裝 robotframework-selenium2library
centos:~ # pip install xpath
centos:~ # pip install robotframework-selenium2library


# 確認 firefox 版本
centos:~ # firefox -v
Mozilla Firefox 52.2.0

# 下載對應版本的 webdriver
centos:~ # wget https://github.com/mozilla/geckodriver/releases/download/v0.17.0/geckodriver-v0.17.0-linux64.tar.gz
centos:~ # tar zxf geckodriver-v0.17.0-linux64.tar.gz -C /usr/local/bin

# 測試
centos:~ # cat test.robot
*** Settings ***
Library        Selenium2Library

*** Variables ***
${delay}=  ${1}
${google_url}=  http://www.google.com
${browser}=  firefox
 

*** Test Cases ***
Test Google
    Open Browser  ${google_url}  ${browser}
    Capture Page Screenshot
    Close Browser

centos:~ # pybot test.robot

若有出現以下錯誤訊息, 須確認 geckodriver 是否有安裝, 是否有執行權限

==============================================================================
test                                                                            
==============================================================================
[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: No browser is open
Test Google                                                           | FAIL |
WebDriverException: Message: connection refused
...

arrow
arrow
    文章標籤
    CentOS RobotFramework
    全站熱搜

    wsunccake 發表在 痞客邦 留言(0) 人氣()