Selenium Java Download Jar For Mac

How to set up a Headless Selenium Testing environment for CentOS 6.3.

On your CentOS 6.3 host

Download and install the Java Software Development Kit (JDK) here. Next – This JDK version comes bundled with Java Runtime Environment (JRE), so you do not need to download and install the JRE separately.

  • In the main folder select the file “selenium-java-x.xx.x.jar” (exact name depending on the version of the selenium library you downloaded.). Again, click the button “Add External JARs”, go to the “lib” folder of the downloaded folder, press Ctrl+A to select all jar-files and then click “Open” again.
  • Download and configure Eclipse or any Java IDE of your choice. Download Selenium WebDriver Java Client; Configure Selenium WebDriver; 1. Download and Install Java. We assume that you have already installed Java 8 or above on your machine and successfully configured the environment variables required to run and compile java programs.

Follow these steps to set up a CentOS 6.3 host to run headless Selenium tests with Firefox.

  1. sudo yum -y install firefox Xvfb libXfont Xorg
  2. sudo yum -y groupinstall 'X Window System' 'Desktop' 'Fonts' 'General Purpose Desktop' (installation takes a few minutes)
  3. Launch an XWindows Virtual Frame Buffer(XVFB) session on display port 99: Xvfb :99 -ac -screen 0 1280x1024x24 &
  4. Tell all XWindows applications in this terminal session to use the new Xvfb display port: export DISPLAY=:99
  5. Start the Selenium server, eg: java -jar /opt/selenium-server-standalone.jar &
  6. Now start your Selenium tests. The Selenium server should spawn a headless Firefox instance and your tests should run successfully.

On your Mac

How to install an XWindows terminal so that you can connect to your CentOS 6.3 host and run your Selenium tests in a graphical Web browser. This capability will be invaluable whenever you need to debug Selenium tests on one of your remote hosts.

Running Selenium tests in the GUI via XWindows

  1. Open XQuartz and ssh to your CentOS host using the -X option, eg: ssh -X [email protected]
  2. On the remote host, type export DISPLAY=localhost:10.0
  3. Start the Selenium server in the same terminal session, eg: java -jar /opt/selenium-server-standalone.jar &
  4. Now simply run your tests and you will see Firefox start up and run in the GUI, just like on the destkop!

Note that it's much slower to execute the tests under XWindows vs. Xvfb.

Connecting to a remote XWindows host

  1. Open XQuartz and ssh to your CentOS host using the -X option, eg: ssh -X [email protected]
  2. On the remote host, type export DISPLAY=localhost:10.0
  3. On the remote host, type firefox & and after a long pause you should see Firefox start up in a GUI window.

Installing XQuartz

XQuartz replaces the old X11 terminal that was part of Mac OS up until Mountain Lion. If you have an older version of Mac OS X then X11 should already be installed, and you can mentally replace 'XQuartz' with 'X11' throughout these instructions.

  1. Get XQuartz here. http://xquartz.macosforge.org/landing/ (The download will take a few minutes.)
  2. Run the installer.
  3. Log out and log back in.
  4. That's it! XQuartz should now be installed.

Further Reading

In this tutorial, we will set up our test environment to run the Selenium automation suite. We will install Java, download Eclipse, add Selenium jars to an Eclipse project, and then provide you a sample script to test the Selenium WebDriver installation.

Selenium Webdriver Installation Steps

Following steps will guide you through setting up Selenium WebDriver on your machine-
Step.1. Configuring Java on a machine.
Download the latest version of the Java Development Kit(JDK) from Oracle.com. Follow the steps mentioned to install JDK. We are installing JDK as it will be required for developing and running our automation scripts which are nothing but Java programs.
Step.2. Download eclipse or any Java IDE of your choice.
Download the latest version of the Java IDE you would like to use, for Eclipse the download link is Eclipse.org. Select the appropriate version of Eclipse depending on your system type- 34 bit or 64 bit.

Java

Download Selenium Jar


Step.3. Download Selenium WebDriver jar from the Selenium.dev website.
Go to the Selenium.dev website and under “Selenium Client & WebDriver Language Bindings”, click on ‘Download’ link for language Java.

Unzip the package and place it on any directory as a library folder.
Step.4. Creating a project and configuring Selenium jars.

Selenium java download jar for mac catalina
  • Launch eclipse.exe.
  • Set your workspace to any location preferably other than C:(a workspace is a physical location where we store our project or group of related projects).
  • Now create a new project- File->New->Project…->Java->Java Project.
  • Name your project and click Finish.
  • Now you will see an src folder under your project. Under this we need to create a package-Right Click src->New->Package (Basically these packages are used to group together related classes). Name your package e.g. ‘myTestPackage’.
  • Inside this package create a new class and name it e.g. Test, your Test.java class will get created.

Step.5. Adding Selenium jars
This step is required for the Selenium installation in Eclipse. Right Click your project on the left and click on properties. A “Properties for {project name}” dialog box will appear. Click on “Java Build Path” on the left and then click on the Libraries tab on the right. In this tab click on the “Add External Jars..” button.

Now browse to the location where selenium libraries are placed (library folder Step#3). Make sure to add both the libraries-selenium-java-2.39.0.jar and selenium-java-2.39.0-srcs.jar along with the libraries present in the libs folder(selenium-2.39.0libs). The selected libraries will appear, click OK to add these libraries to your project. You can verify the same in the “Referenced Libraries” section under your project in the “Package Explorer” section on the left.
Step.6. Creating the first Selenium WebDriver project
Time to test the setup. Now, we will create our first selenium project, in which we will just open the Firefox browser and launch a website. The following steps are required to launch the firefox browser.

  1. Download geckodriver.exe from GeckoDriver Github Release Page. Make sure to download the right driver file based on your platform and OS version.
  2. Set the System Property for “webdriver.gecko.driver” with the geckodriver.exe path – System.setProperty(“webdriver.gecko.driver”,”geckodriver.exe path”);

Code snippet to launch the Firefox browser

Java

To run the test, right-click on Test.java file on the Package Explorer section, hover over “Run As” and select “Java Application”. Firefox browser will launch and open artoftesting.com.

Selenium Java Download Jar For Mac 64-bit


That’s all we have in this post. Check out our complete Selenium WebDriver tutorial here – Selenium WebDriver – Complete Step-by-Step Tutorial. Thanks.

Selenium Java Download Jar For Mac Os

Kuldeep is the founder and lead author of ArtOfTesting. He is skilled in test automation, performance testing, big data, and CI-CD. He brings his decade of experience to his current role where he is dedicated to educating the QA professionals. You can find him on LinkedIn.