Automate Safari web browser using C # on Windows

I wondered if anyone had done it successfully or knew how to automate a Safari web browser on a Windows platform.

Ideally, I would like to automate Safari similarly to using mshtml for Internet Explorer. Otherwise, it would be nice to use JavaScript to start the process. I used the JavaScript injection method to automate Firefox through the jssh plugin.

I am looking to automate the browser using .Net to improve the existing automation infrastructure of WatiN

Change Although I believe that selenium may be a great choice for Safari automation in certain scenarios, I would like to use a solution that does not require software installation on a server, such as Selenium Core or an intermediate proxy server in the case of Selenium Remote Control.

Update: 03-23-2009 : While I have not yet found a way to automate Safari, I have found a way to automate Webkit inside Chrome. If you start Chrome using the command line switches --remote-shell-port = 9999 (ref: http://www.ericdlarson.com/misc/chrome_command_line_flags.html ), you can send javascript to the browser.

After connecting to remote debugging

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

We used this method to add Chrome support for WatiN

+4
source share
4 answers

you can check my post here where I use the method described above to automate Chrome in C #

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

Martin

+2
source

I'm not sure if this helps, but the guys at ArtOfTest have added Safari support to their .Net WebAii-based automation infrastructure. Perhaps you could understand what they are doing.

+2
source

Selenium was very useful for me for compatibility testing.

+1
source

WatiN here http://watinandmore.blogspot.com/2010/01/browserattachto-and-iattachto.html allows you to automate IE and FF. It is open source, so you can see how they do it.

Maybe you can adapt it to your needs?

+1
source

Source: https://habr.com/ru/post/1276676/


All Articles