<p>I wondered if anyone had successfully managed, or knew how to automate the Safari web browser on the Windows platform.</p>

<p>Ideally I would like to automate Safari in a similar way to using <a href="http://msdn.microsoft.com/en-us/library/aa741317.aspx" rel="nofollow noreferrer">mshtml</a> for Internet Explorer. Failing that a way to inject JavaScript into the running process would also be fine. I've used the JavaScript injection method to automate Firefox via the <a href="http://www.croczilla.com/jssh" rel="nofollow noreferrer">jssh</a> plug-in.</p>

<p>I'm looking to automate the browser using .Net to enhance an existing automation framework <a href="http://watin.sourceforge.net/" rel="nofollow noreferrer">WatiN</a></p>

<p><strong>Edit</strong>: Whilst I think selenium might be a great choice for automating Safari in certain scenarios, I would like to use a solution that does not require installing software on the server i.e. Selenium Core or an intermediate proxy server in the case of Selenium Remote Control.</p>

<p><strong>Update: 23-03-2009</strong>:
Whilst I've not yet found a way to automate Safari, I have found a way to automate Webkit inside of Chrome. If you run Chrome using the --remote-shell-port=9999 command line switches (ref: <a href="http://www.ericdlarson.com/misc/chrome_command_line_flags.html" rel="nofollow noreferrer">http://www.ericdlarson.com/misc/chrome_command_line_flags.html</a>) you can send javascript to the browser.</p>

<p>Once connected to the remote debug seesion</p>

<ul>
<li>Send <strong>debug()</strong> to attach to the current tab</li>
<li>Send any javascript command using <strong>print</strong>, i.e. print document.window.location.href</li>
</ul>

<p>We've used this method to add <a href="http://watin.svn.sourceforge.net/viewvc/watin/trunk/src/Core/Native/Chrome/" rel="nofollow noreferrer">Chrome support to WatiN</a></p>

[{'answer_id': 60622, 'author': 'Nick Stinemates', 'author_id': 4960, 'author_profile': 'https://Stackoverflow.com/users/4960', 'pm_score': 1, 'selected': False, 'text': '<p><a href="http://selenium.openqa.org/" rel="nofollow noreferrer">Selenium</a> has been very useful for me for compatibility testing.</p>\n'}, {'answer_id': 859647, 'author': 'Randall Sutton', 'author_id': 91177, 'author_profile': 'https://Stackoverflow.com/users/91177', 'pm_score': 2, 'selected': False, 'text': '<p>I\'m not sure if this helps, but the guys at <a href="http://www.artoftest.com" rel="nofollow noreferrer">ArtOfTest</a> have added Safari support to their .Net based automation framework WebAii.  Maybe you could figure out what they are doing.</p>\n'}, {'answer_id': 6281622, 'author': 'Andreas Reiff', 'author_id': 586754, 'author_profile': 'https://Stackoverflow.com/users/586754', 'pm_score': 1, 'selected': False, 'text': '<p>WatiN here <a href="http://watinandmore.blogspot.com/2010/01/browserattachto-and-iattachto.html" rel="nofollow">http://watinandmore.blogspot.com/2010/01/browserattachto-and-iattachto.html</a> lets you automate IE and FF. It is open source, so you can have a look on how they do it.</p>\n\n<p>Maybe you can adapt it to your needs?</p>\n'}, {'answer_id': 9358274, 'author': 'Martin Kunc', 'author_id': 1220568, 'author_profile': 'https://Stackoverflow.com/users/1220568', 'pm_score': 3, 'selected': True, 'text': '<p>you might check my post here where I am using the method described above to automate Chrome in C#</p>\n\n<p><a href="http://markcz.wordpress.com/2012/02/18/automating-chrome-browser-from-csharp/" rel="nofollow">http://markcz.wordpress.com/2012/02/18/automating-chrome-browser-from-csharp/</a></p>\n\n<p>Martin</p>\n'}]
['https://Stackoverflow.com/questions/60609', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5182/']