Using safari on MAC OS X using selenium

Hoi,

while setting up our new testing Machine ( a very old PowerPC with 466 Mhz ;) ) I realized that it is not that easy to make Safari work using Selenium RC. With Michele from mayflower helping me we could make it work.

Here is the solution:

1. Use this patched Version of Selenium RC Snapshot with Safari and MAC OS X support ( it is the snapshot including the patch from here ).

2. Start Selenium using sudo

3. If you face any problems like “Please add the directory containing networksetup to your path” then you should check your disc under /System/Library/CoreServices/RemoteManagement/ARDAgent.app/
Contents/Support/networksetup - this directory should exist. If not - like on my old machine - you need to create a symlink to the correct directory - e.g.
“sudo ln -s networksetup-panther networksetup”

That’s it - I hope it helps I needed quite a few hours to figure this out.

Comments

5 Responses to “Using safari on MAC OS X using selenium”

  1. Mahi on January 17th, 2008 5:27 pm

    After lot of trying and head breaking, we found your link and tried your suggestion. It worked for us. Thank you once again!

    Cheers!
    -Mahi

  2. Vasavi Kaza on February 28th, 2008 1:52 am

    Thanks a lot. It is not just for Safari, even for firefox browser, I had to start selenium using sudo.I fought with this issue for lot of days. Me being first one in my company to implement this, there was no help too. Your suggestion was helpful.

  3. Kuntal on November 23rd, 2010 12:36 pm

    Hi ,

    I need to run Selenium RC on Mac OS with Safari.
    But, I am not getting what is Sudo?
    Is it the Sauce Labs Sauce RC?

    Please reply.I need your help.

    Regards,
    Kuntal

  4. Pavithra on July 11th, 2011 8:48 am

    Hi,
    I am also not getting what you are exactly doing here.
    I am also facing the issue of starting safari in macos.
    I am using remotewebdriver to start the selenium as below:
    Selenium sel = new DefaultSelenium(”localhost”, 4444, “*safariproxy /Applications/Safari 5.app”,baseURL);
    CommandExecutor executor = new SeleneseCommandExecutor(sel);
    DesiredCapabilities dc = new DesiredCapabilities();
    dc.setJavascriptEnabled(true);
    driver = new RemoteWebDriver(executor, dc);

    but I am getting the below error :
    java.io.filenotfoundexception
    Caused by: java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: java.lang.RuntimeException: java.io.FileNotFoundException: /Applications/Safari 5.app (No such file or directory)
    at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:104)

    But I am having my safari 5 under /Applications.
    Please help me out !!

  5. srinivas on September 28th, 2011 8:02 pm

    Hi,
    I ran the sudo command for networksetup,after that i ran java -jar seleniumerver -htmlsuite browser suitefile results file from command prompt.But getting unable to access networksetup file error.

    Could u pls help on this.

Leave a Reply