Question

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

Ideally I would like to automate Safari in a similar way to using mshtml 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 jssh plug-in.

I'm looking to automate the browser using .Net to enhance an existing automation framework WatiN

Edit: 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.

Update: 23-03-2009: 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: http://www.ericdlarson.com/misc/chrome_command_line_flags.html) you can send javascript to the browser.

Once connected to the remote debug seesion

  • Send debug() to attach to the current tab
  • Send any javascript command using print, i.e. print document.window.location.href

We've used this method to add Chrome support to WatiN

Was it helpful?

Solution

you might check my post here where I am using the method described above to automate Chrome in C#

http://markcz.wordpress.com/2012/02/18/automating-chrome-browser-from-csharp/

Martin

OTHER TIPS

I'm not sure if this helps, but the guys at ArtOfTest have added Safari support to their .Net based automation framework WebAii. Maybe you could figure out what they are doing.

Selenium has been very useful for me for compatibility testing.

WatiN here http://watinandmore.blogspot.com/2010/01/browserattachto-and-iattachto.html lets you automate IE and FF. It is open source, so you can have a look on how they do it.

Maybe you can adapt it to your needs?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top