Wilson Mar bio photo

Wilson Mar

Hello. Hire me!

Email me Calendar Skype call 310 320-7878

LinkedIn Twitter Gitter Google+ Youtube

Github Stackoverflow Pinterest

Run browsers automatically for videos (and testing)


Although Selenium was created for functional testing, people are using it to repeatedly run through web pages for several purposes, such as getting timings as the basis for recording screencast videos.

Install prequisite dependencies

Follow my other tutorials to install:

  1. Java
  2. Maven
  3. Chrome with ChromeDriver
  4. Firefox browser
  5. GeckoDriver
  6. Eclipse IDE (optionally)

Download from GitHub and Run

  1. Change to a folder where you can get a sample repo on your local hard drive.

    This sample doesn’t control an internet browser:

    cd ~/gits
    git clone --depth=1 https://github.com/eviltester/startUsingJavaJUnit
    cd startUsingJavaJUnit

    --depth=1 specifies no history, since we don’t want to update it, just use the latest version. Thus we save some disk space.

    Cloning into 'startUsingJavaJUnit'...
    remote: Counting objects: 14, done.
    remote: Compressing objects: 100% (8/8), done.
    remote: Total 14 (delta 0), reused 10 (delta 0), pack-reused 0
    Unpacking objects: 100% (14/14), done.
  2. Verify if Maven can download libraries specified in the app’s pom.xml file:

    mvn test

    If SUCCESS is returned, you’ll get a lot of outputs ending with something like:

    Running com.javafortesters.junit.MyFirstTest
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.039 sec
    Results :
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
    [INFO] ------------------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 4.010 s
    [INFO] Finished at: 2016-11-21T11:01:56-07:00
    [INFO] Final Memory: 16M/215M
    [INFO] ------------------------------------------------------------------------

Selenium frameworks

  1. Import into the IDE from (not https):

  2. Scroll to Selenium Standalone Server to click the Download link. At time of writing, it was:

    Download version 3.4.0
    File Download
    selenium-server-standalone-3.4.0.jar 21.8 MB
    selenium-server-standalone-3.0.1.jar 21.1 MB
  3. Verify that version is in the pom.xml.


  1. Download and install Firefox from Mozilla. On a Mac, use:

    brew install firefox
  2. See the version by clicking Help > Firefox Health Report. Alternately, click Firefox > About.

    The version installed should be 50.0 or above.

  3. Install the Gecko driver which Selenium uses:


    Note you need to be using the latest Selenium (which was 3.3.1 as of this writing).

  4. Add to the path your operating systems uses to find executables the Gekodriver executable:

    echo “export PATH=$PATH:~/Downloads/geckodriver” »~/.bash_profile

    NOTE: On MacOS, the separator between folders is a colon vs. a semi-colon on Windows.


  1. At


  2. Scroll down to click “DOWNLOAD” of the .DMG installer for the Community Edition.

    File ideaIC-2016.2.5.dmg was 313 MB, which is version 2016.2.

  3. In Finder at the Downloads folder, click the .dmg file.

  4. Drag the resulting file into your Applications folder.
  5. Dismiss the pop-up.
  6. In Finder, move the .dmg file to trash to save disk space.
  7. In Finder Devices section at the left, eject the IntelliJ IDEA CE installer.
  8. In Finder Applications, scroll to IntelliJ IDEA CE and open it.
  9. Import if you have a previous version installed.

    New project in IntelliJ

  10. Create New Project.
  11. Click New… to the right of Project SDK (Software Development Kit).
  12. Select JDK and press OK to confirm use of:


  13. Click Next with “Create project from template” unchecked.
  14. Overtype untitled with a Project name such as “Selenium-3.0.1”.

    PROTIP: Instead of spaces in project names, use dashes or underlines for compound words.

  15. Change the Project location to fit your standards. Click Finish.


  16. If you see message “Unregistered VCS root detected”, click the little arrow and select Configure.
  17. Switch temporarily to a Terminal to isssue which git. Copy the response, such as:


  18. Expand Version Control. Click Git. In the “Path to Git executable”, paste the path. Click Test.
  19. Click OK to the “Git executed successfully” pop-up.
  20. Click OK to dismiss the VCS dialog.

    src Selenium class

  21. Alt-click on src, New, Java Class. For Name, use N.N.N.N such as:


    TODO: Define your naming convention in java programs.

  22. Click OK for a file that makes use of the class name just defined:

    package com.jetbloom.Selenium;
            * Created by mac on 11/21/16.
    public class TestCase01 {
  23. Replace the file contents with a sample Selenium Java program:

    package com.jetbloom.Selenium;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    public class TestCase01 {
     public static void main(String[] args){
         WebDriver driver=new FirefoxDriver();

    Maven pom.xml

  24. Alt-click on the module name (in this example, “Selenium-3.0.1”) and select “Add framework support…”.
  25. Check “Maven” then OK. This creates a pom.xml for you to modify.
  26. At the lower-right corner, if there is a message “Maven projects need to be imported”, click “Enable Auto-omport”.

  27. Change the “groupID” to “com.jetbloom.Selenium”.
  28. Copy and paste this before the /project> tag:

  29. Click Run from the menu or press keys.
  30. Select TestCase01.

  31. In the JRE section, select Use an execution enviornment JRE of “JavaSE-1.8”. Click Next.
  32. In Java Settings, click Libraries tab, Add External JARs. Select the Selenium jar file. Click Open. Click Finish.
  33. In the Package Explorer, select your project,
    expand Reference Libraries to see the Selenium jar.


Speed measures

sitespeed.io to measure web performance using Selenium as described at https://www.youtube.com/watch?v=cLlZhnZvi1M by Peter Hedenskog
of Wikipedia.




https://www.youtube.com/watch?annotation_id=annotation_779954917&feature=iv&src_vid=nq97dfaVmC4&v=ff5ZsthcSZw How to Install Java, Maven and IntelliJ on Apple Mac


https://www.youtube.com/watch?v=rJ4rNZGAzW8 How to start firefox Browser in Selenium webdriver 3 with Gecko Driver by Mukesh Otwani