How to Install Firefox, Marionette GeckoDriver, Chrome, ChromeDriver for Selenium WebDriver on Mac

preview_player
Показать описание
How to install and run a test against:

* Firefox, Marionette GeckoDriver
* Chrome, ChromeDriver

For Selenium WebDriver using Java on a Mac.

We also use a sample test project on github to make it easy to check if you have everything installed correctly.

If you use the github project then you'll see a check list you can use to keep your install simple.

Рекомендации по теме
Комментарии
Автор

Hi alan,
it seems that i can't make the .bash_profile .. i put the extracted gecko driver in folder named webdriver then when i run Gecko driver this is what i get in terminal:

Last login: Wed Nov 16 02:02:52 on ttys001
karma:~ aliya$ ; exit;
Segmentation fault: 11
logout

[Process completed]

Then when i open new window and type the command "vi .bash_profile " i get only this

".bash_profile" [New File]

what am doing wrong ?

Karmaa
Автор

All fine, but when i try to execute in intellij IDEA i recived this error:
The path to the driver executable must be set by the webdriver.gecko.driver system property;
Intellij idea ask me for a sdk and i chose the jdk 1.8 folder
can you help me?

gabomoto
Автор

I got the following error using the latest version of firefox (50.0.2) on my mac. Using selenium 3.0.1.

Ron$ mvn test -Dtest=MyFirstTest
[INFO] Scanning for projects...
[INFO]
[INFO]
[INFO] Building MyFirstSeleniumIntelliJMaven 1.0
[INFO]
[INFO]
[INFO] --- (default-resources) @ MyFirstSeleniumIntelliJMaven ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory
[INFO]
[INFO] --- (default-compile) @ MyFirstSeleniumIntelliJMaven ---
[INFO] No sources to compile
[INFO]
[INFO] --- (default-testResources) @ MyFirstSeleniumIntelliJMaven ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory
[INFO]
[INFO] --- (default-testCompile) @ MyFirstSeleniumIntelliJMaven ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- (default-test) @ MyFirstSeleniumIntelliJMaven ---
[INFO] Surefire report directory:


T E S T S

Running
Usage:
[OPTIONS]
Unknown option --port=17609
Dec 04, 2016 8:45:00 PM createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 22.166 sec <<< FAILURE!
Time elapsed: 22.123 sec <<< ERROR!
The driver server has unexpectedly died!
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'Rons-Mac-Mini.fios-router.home', ip: '192.168.1.4', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.1', java.version: '1.8.0_91'
Driver info: driver.version: FirefoxDriver
at
at
at
at
at
at
at
at
at
at
at Method)
at
at
at
at
at
at
at
at
at
at
at
at
at
at
at
at
at
at
at
at Method)
at
at
at
at
at
at
at
at
Caused by: Connect to localhost:17609 [localhost/127.0.0.1] failed: Connection refused
at
at
at
at
at
at
at
at
at
at
at
at
at
at
at
at
... 38 more
Caused by: java.net.ConnectException: Connection refused
at Method)
at
at
at
at
at
at
at
... 53 more


Results :

Tests in error:
The driver server has unexpectedly died!(..)

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[INFO]
[INFO] BUILD FAILURE
[INFO]
[INFO] Total time: 24.189 s
[INFO] Finished at: 2016-12-04T20:45:01-05:00
[INFO] Final Memory: 11M/155M
[INFO]
[ERROR] Failed to execute goal (default-test) on project MyFirstSeleniumIntelliJMaven: There are test failures.
[ERROR]
[ERROR] Please refer to for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:

slade
Автор

Hi Alan
thank you very much for the video!

I have launched the test for Chrome and Firefox from the terminal. Everything is fine with it.

But I couldn't run the tests from IntelliJ IDEA.
In both cases (Firefox and Chrome) I got an error: The path to the driver executable must be set by the webdriver.chrome.driver system property;

So I have added the following string under the startWebDriver method:
System.setProperty("webdriver.gecko.driver", "/path to geckodriver"); - for FireFox
System.setProperty("webdriver.chrome.driver", "/path to geckodriver"); - for Chrome

After this everything worked fine for me.
I have FireFox 49.0.2 and Chrome 54...

Do I have any chance to get rid of extra string which I've inserted?

yaroslavkabay