30 Replies Last post: Jan 5, 2009 1:28 PM by Dan Fabulich   Go to original post 1 2 3 Previous Next
Patrick Lightbody Hero 915 posts since
Nov 3, 2005
Currently Being Moderated
15. Oct 10, 2008 8:41 AM in response to: Paul Hammant
Re: *iexplore launching HTA?

I'm not sure if I agree with your sentiment Paul. Generally, we've seen HTA mode as being much more stable than IE PI mode or even IE multi-window mode. I suggest we let Dan and Philippe (who are both on vacation but will be back next week) come back and justify their decision.

 

Generally, I thought the conclusion from our last meetup was that for a 1.0 final release we would change the default modes to use the recommended browser launcher and that we weren't going to enforce API or execution compatibility until we hit a 1.0 final release.

 

Patrick

 

 

Patrick Lightbody Hero 915 posts since
Nov 3, 2005
Currently Being Moderated
16. Oct 10, 2008 8:44 AM in response to: Jennifer Bevan
Re: *iexplore launching HTA?

So, let me clarify one thing -- *iexploreproxy uses exactly what *iexplore

used to use, right?  (I can check the source in a little bit).  That is one

of our potential solutions, namely because finding all of the occurrences of

the use of the location properties is 1. tricky and 2. there are a lot of

them.

 

I think it does. I can't recall if *iexplore used PI mode or not. It's gone through a few changes, so depending on which build you have the answer may be different.

 

We aren't finding any other significant 'bugs', per se.  It's mainly that

many of the tests running here use these fields, which were legal in

*iexplore, and are no longer legal.

 

Can you provide us a test case that reproduces this issue? I think that should be the first step to any action we take (including rolling back the recent change).

 

Out of curiousity -- why call the new *iexplore *iexploreproxy if it doesn't

use proxy injection? 

 

Yeah, it sounds confusing, but there is a reason PI mode is where Selenium is actually injected in (via a proxy). But the old "original" mode also depends on a proxy as well, since it needs the proxy to make the Selenium browserbot code appear on every domain.

Patrick Lightbody Hero 915 posts since
Nov 3, 2005
Currently Being Moderated
17. Oct 10, 2008 8:48 AM in response to: Erik Beans
Re: *iexplore launching HTA?

We always start the server with -multiWindow, and the calls to selenium which opened up IE were using *iexplore. 

 

OK, good. Generally our feeling has been that HTA is better than other modes, but that "original" mode + multi-window was better than just "original" mode by itself. So if HTA is giving you issues, then you've got the next best option.

 

Now, *iexplore was changed to *iexploreproxy. 

 

Yes, I think, though you might want to double check to make sure your build wasn't one of the ones that had iexplore mode actually using proxy injection (I doubt it, but can't hurt to double check).

 

At Google, about 30% of the tests that we run have some integration with code that will not work with the HTA browser because of the permission denied issue.  This will require us to go back to using full blown IE and changing all the targets to *iexploreproxy. 

 

My suggestion is to change the default mode back to full blown IE and then make HTA mode available with some other target name *iexplore-hta perhaps

 

Any reason you can't change your launch strings to just use *iexploreproxy? Or, if that's hard because it's embedded in the tests, you could easily overwrite the iexplore browser launcher for your Selenium Server instances that sets iexplore back to what you need. Check out BrowserLauncherFactory.addBrowserLauncher. I bet that will give you the quickest path to victory.

 

Source code here:

 

http://svn.openqa.org/fisheye/browse/selenium-rc/trunk/server-coreless/src/main/java/org/openqa/selenium/server/browserlaunchers/BrowserLauncherFactory.java?r=2450

 

Erik Beans Beginner 13 posts since
Sep 16, 2007
Currently Being Moderated
19. Oct 14, 2008 1:35 AM in response to: Patrick Lightbody
Re: *iexplore launching HTA?

Here is some more information on the problem of changing the default browser target to HTA mode instead of leaving it as the regular Internet Explorer.  Take a web page as simple as the following:

 

<html>
<script type="text/javascript">
function applicationValidate() { return window.location.href; }
</script>
</html>

 

It can do any number of operations but the key is that the web application under test uses the window.location.href object.

 

 

Then if you have a selenium test that runs the following

 

String script = "var win = selenium.browserbot.getCurrentWindow(); win.applicationValidate()";
String pageTitle = selenium.getEval(script);

 

 

You will get a permission denied error now, as of revision 2450 because of the change from the default iexplore target to the other hta mode target.

 

I believe that a lot of users who upgrade from the older version of selenium to 1.0beta will experience issues with their test suites or test frameworks, especially if they are trying to test javascript on the web application under test.  The fact that rev 2450 causes this HTA browser limitation to be exposed as a default way of running selenium is extremely discouraging for people who want to upgrade.

 

Erik

Dan Fabulich Almighty 919 posts since
Dec 8, 2005
Currently Being Moderated
20. Oct 14, 2008 1:51 AM in response to: Jennifer Bevan
Re: *iexplore launching HTA?

I stand by our decision to make HTA mode the default mode.

 

First, to answer a question raised earlier: why's it called *iexploreproxy, when it isn't using proxy injection?  There are actually two "proxy" modes available for IE.  In Proxy Injection mode (*piiexplore), every HTML page is modified to include Selenium.  In the other mode (*iexploreproxy), the proxy never modifies pages.  Instead, it makes a phantom copy of Selenium available on every domain.  It's an alternate way to defeat the same-origin policy.

 

In *iexploreproxy mode we can test only one domain at a time, but it can be any domain.  If we want to test example.com, we load up a Selenium frame at http://example.com/selenium-server/.  Selenium scripts on example.com can be used to read/modify any page on example.com, so they appear to work as normal.  But we're screwed if we need to test multiple domains, even if the domains are very similar.  For example, we can't test both "www.example.com" and "example.com" in the same test.  Nor can we test "www2.example.com", nor can we test both HTTP and HTTPS pages from example.com in the same test.

 

In a very normal use case, this means that the user can't login to their web application, because logging in switches the site from HTTP to HTTPS and then back again.

 

The limitations inherent in *iexploreproxy are very severe and affect many ordinary users of Selenium, especially those who originally wrote their tests in Selenium IDE where they aren't confined by origin.  Today, these users reliably come to the forums to ask why their test script works in Selenium IDE but not in Selenium RC; it often takes quite a bit of diagnosis to find out that they're crossing the domain boundary.

 

There are no inherent restrictions in *iehta mode, despite the linked MSDN kb article.  Those restrictions apply only to the HTA frame, to Selenium Core itself, and not to the application under test, which is run in a separate window by default.  That window is free to access window.location and do whatever it needs to do with it.  Selenium has to be written very carefully to handle this case, but ordinary users will not and should not be affected.

 

As I'm sure you're aware, there is no one mode that is best for everyone; I'm well aware of the limitations inherent in HTA mode, not least because of the numerous workarounds I've coded in Selenium Core to support HTA mode's quirks.  *iexploreproxy is better than *iehta when it works at all, but if you need multi-domain support, as most users do (whether or not they know it), you simply cannot use *iexploreproxy mode at all.

 

-Dan

Dan Fabulich Almighty 919 posts since
Dec 8, 2005
Currently Being Moderated
21. Oct 14, 2008 1:56 AM in response to: Erik Beans
Re: *iexplore launching HTA?

Erik, your example is interesting, but we can fix it (as we have fixed numerous other Selenium Core bugs).  getEval currently runs a raw eval in the context of the HTA frame, but we could make it do the eval in the context of the application under test instead.  (We'd have to get clever with timeouts, but it's not insurmountable.)

 

With that said, there's also a straightforward workaround available today: you can use runScript instead of getEval.  runScript launches the script as an inline script tag in the AUT, where it runs under the AUT's security context.  No HTA restrictions there.  Alternately, there's an even easier workaround available to you because you're running a single-origin test: just use *iexploreproxy!

 

I've fixed a great many of these HTA bugs.  There are a finite number of them; they're pretty easy to fix once you understand them.  I'd even go as far as to say that we've quashed most of them.  Reading this post doesn't really worry me; it just encourages me to fix the bug.

 

-Dan

Haw-Bin Chai Master 515 posts since
May 19, 2006
Currently Being Moderated
23. Oct 14, 2008 11:44 AM in response to: Dan Fabulich
Re: *iexplore launching HTA?

I personally don't have an objection to making *iehta the "default" mode. What I find somewhat problematic is the renaming of an existing mode to be something completely different. People's brains, which were previously wired to understand *iexplore != *iehta now have to undo that association.

 

Might we not simply introduce a new *iedefault launcher as a synonym for *iehta, and simply reference *iedefault as the "preferred" way to get started with Selenium in the docs? That way we could leave *iexplore as is, and potentially save a lot of people from having to update their tests.

 

 

 

Haw-Bin

 

Message was edited by: Haw-Bin Chai

Erik Beans Beginner 13 posts since
Sep 16, 2007
Currently Being Moderated
25. Oct 14, 2008 1:38 PM in response to: Dan Fabulich
Re: *iexplore launching HTA?

There is now a bug on this issue:

 

http://jira.openqa.org/browse/SEL-587

 

Erik

Dan Fabulich Almighty 919 posts since
Dec 8, 2005
Currently Being Moderated
26. Oct 14, 2008 7:34 PM in response to: Haw-Bin Chai
Re: *iexplore launching HTA?

IMO, long term (maybe short-term?) I'd rather that we implement mode switches with launcher options, rather than as separately named launchers.

 

We shouldn't have *iexplore, *piiexplore, *iexploreproxy and *iehta (and *iedefault?); instead, we should be doing something like this:

 

cmd=getNewBrowserSession&1=*iexplore&2=http://google.com&3=mode:hta

cmd=getNewBrowserSession&1=*iexplore&2=http://google.com&3=mode:proxyInjection

cmd=getNewBrowserSession&1=*iexplore&2=http://google.com&3=mode:singleOrigin

  and, when launching firefox,

cmd=getNewBrowserSession&1=*firefox&2=http://google.com&3=mode:chrome


This doesn't entirely solve the problem; what should we do if you don't specify a mode?  But at least all Google employees could start saying "mode:singleOrigin" today, even with Selenium 0.9.  (0.9 will discard unrecognized options.)  When upgrading to 1.0, unrecognized preferences would become activated.

 

As for "*iedefault", I'm not sure how that would translate into launcher options, but I'm not sure we'll need it if we implement a launcher options scheme, right?

 

-Dan

Dan Fabulich Almighty 919 posts since
Dec 8, 2005
Currently Being Moderated
27. Oct 14, 2008 7:35 PM in response to: Erik Beans
Re: *iexplore launching HTA?

Despite my flip remarks earlier, fixing SEL-587 the way I described would have a drawback: you could no longer write an eval with elevated privileges... you'd HAVE to be within the application's reduced security context.  That seems bad; I'm not sure how bad or what I think about it.  I really don't want to make this any more complicated than it needs to be...

More Like This

  • Retrieving data ...