"Nate Kirby" wrote on 10/21/2005 02:55:45 PM:
> I also could not get these directions to work at all in Firefox.  I 
thought
> selenium was browser agnostic.

Regarding Firefox, let me make a quick note:
I don't think anyone else has noticed this or mentioned this... But the 
Firefox-only Selenium Recorder lets you test foreign sites (like Google) 
with ease... Since it is a "chrome" application... It is not subject to 
the same security policies that plain old Selenium is subject to... If you 
want to use Firefox to test Google using the HTML table style of selenium, 
I would investigate the Selenium Recorder further...


Okay, for a longer answer....
Selenium is browser agnostic... at its core it's just HTML and JavaScript 
and a few stylesheets. However, hacking around security protections to 
test a remote site is mostly not browser agnostic...

Not too many apps try to do what Selenium is trying to do... In fact, 
Selenium is trying to do what most security experts would consider a 
security bug.... Selenium is *merely* JavaScript. It is JavaScript running 
in one frame, that drives a website in a child iframe. All is fine if 
Selenium is installed on the same site and server as the one you are 
testing... But if you try to test some foreign site, like Google... this 
is called "cross site scripting"... and has been locked down and labeled a 
security hole by everyone in the universe. Unfortunately, turning off this 
security for the benevolent purposes of testing with Selenium is not easy 
or as straight forward as you'd hope.

However, one of the easiest ways to get around the security sandbox that 
Selenium sits in, and to thus be able to test foreign sites, is use an 
"HTA" application. By definition... this is Windows/Internet Explorer 
only. Microsoft "turns off" lots of JavaScript security protections that 
you'd normally see in a web page if you merely rename your ".html" to 
".hta".... So it's a trade-off... Sadly, Microsoft has mostly disowned its 
HTA work... Perhaps, HTML+JavaScript+No Security as a replacement for 
writing desktop apps was hurting sales of Visual Studio. ;-)

There are a few other alternatives, though...if you want to test foreign 
sites in a truly browser agnostic way with Selenium... you could install 
the Selenium Standalone Server on your computer... The Standalone Server 
does its security workaround magic by using James Marshall's excellent 
reverse proxy script to make local selenium and the foreign site all look 
like they're coming from localhost... thus getting around JavaScript 
security. A hack, yes... and it works in most cases, but it is dark magic 
in how it works.... The standalone server also throws in a few extra 
goodies in allowing you to write your test scripts in any language you 
prefer via a built-in XML-RPC gateway. The down side to using the 
Standalone Server is that I haven't had/made the time to keep it 
up-to-date lately. Though I hope that changes in the near future.

I think there are three futures for Selenium. (2 of which can be used for 
testing remote sites)...
1) "Plain old Selenium" --- you embed it in your site with all your other 
html and JavaScript files... Tests are written as HTML tables (or maybe 
straight JavaScript in the future)... However, you can't test a remote 
site in this configuration because of security restraints enforced by all 
browsers.
2) Standalone Server Selenium -- uses some reverse proxy trickery to work 
around cross site scripting security... It works for testing a remote 
site, but uses dark, magic. And magic is bad.
3) Expand the use of browser plug-ins like Selenium Recorder... Plug-ins 
are probably the least "hacky".and "magical".. since the browser 
implicitly trusts a plug-in and allows it do anything... However, this is 
*more work*... We would need to write a browser plug-in for each major 
browser and keep them up-to-date with each new browser release.  Google's 
Toolbar, the GreaseMonkey plug-in would be used as inspiration. Actually, 
I imagine some kind of mash-up of Greasemonkey and Selenium Recorder would 
be the result. By the way, Selenium Recorder rocks and I'd like to see its 
development continue.

I'll leave the HTA Selenium thing out of the future since its not cross 
browser and not cross platform and there are no guarantees from Microsoft 
that they'll keep supporting it.

- Jason
_______________________________________________
Selenium-users mailing list
Selenium-users@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-users

Reply via email to