星期日, 11月 03, 2019

[Eggplant] 使用eggplant functional連結Selenium進行自動化測試(一):安裝 mac測試環境

本文以Mac開發環境來記錄整個安裝Selenium WebDriver Testing流程。

系統限制

Note: Eggplant Functional works with Selenium Server 2.0, also known as Selenium WebDriver. Supported browsers are Firefox, Google Chrome, Microsoft Edge, Microsoft Internet Explorer 10, and Safari. Typically, you need to install a driver for each browser type you want to use.

要注意非windows環境要額外裝自已要的WebDriver

運作方式

SenseTalk <==> Selenium Server <==> Browser Drivers <==> Web Page


前置環境建置

安裝homebrew

進入/usr/bin目錄安裝homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"




安裝Java

透過homebrew
brew cask install java

安裝Selenium伺服器

brew install selenium-server-standalone
安裝後可以執行以下測試selenium版本的指令,看是否正常運作。

selenium-server --version


MacBook-Pro-2:bin bigd$ selenium-server --version
Selenium server version: 3.141.59, revision: e82be7d358


啟動/關閉Selenium伺服器

執行以下即可啟動
selenium-server -port 4444
PS: 指令視窗是不可以關掉的,才有辦法讓selenium與WebDriver溝通


MacBook-Pro-2:bin bigd$ selenium-server -port 4444
16:27:37.241 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
16:27:37.370 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2019-11-03 16:27:37.470:INFO::main: Logging initialized @467ms to org.seleniumhq.jetty9.util.log.StdErrLog
16:27:37.833 INFO [WebDriverServlet.] - Initialising WebDriverServlet

16:27:37.965 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444

安裝ChromeDriver

請確認你電腦的chrome版本決定要下載的ChromeDriver版本



78版 (支援mac/linux/win32)
https://chromedriver.storage.googleapis.com/index.html?path=78.0.3904.70/

編輯/etc/paths

PS:/Users/bigd/Documents為你下載chromedriver執行的地方
#設定你webdriver放置的路徑
/Users/bigd/Documents
  
/usr/local/bin
/usr/bin
/bin
/usr/sbin

/sbin

安裝時要多允許安裝






參考連結

//教你如何在mac/window下設定eggplant與selenium
http://docs.testplant.com/ePF/using/epf-selenium-webdriver-testing.htm

沒有留言:

張貼留言

留個話吧:)