Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Selecting Internet Explorer document mode at webdriver session startup #2564

Open
lukeis opened this issue Mar 3, 2016 · 10 comments
Open

Selecting Internet Explorer document mode at webdriver session startup #2564

lukeis opened this issue Mar 3, 2016 · 10 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 3, 2016

Originally reported on Google Code with ID 2564

When testing Web applications in Internet Explorer, it is useful to test your web pages
under various document compatibility modes (Quirks, IE7, IE8, IE9). In Selenium 1,
it is possible using keyboard events (keyDownNative etc) to open the developer tools
and change the mode.

In Selenium 2, it could be interesting to add parameters to a webdriver instance, so
that one can choose the document mode. It may be possible to implement this using the
FEATURE_BROWSER_EMULATION registry key:

http://msdn.microsoft.com/en-us/library/ee330730%28VS.85%29.aspx#browser_emulation

Reported by fred.wang@free.fr on 2011-09-30 08:00:05

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by james.h.evans.jr on 2011-09-30 14:41:05

  • Labels added: Type-Enhancement
  • Labels removed: Type-Defect

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by barancev on 2011-10-03 12:17:53

  • Labels added: Component-WebDriver, Browser-IE

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Any update on this endeavour ?

Reported by slaneyrw on 2012-01-16 22:19:25

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Can a project member please indicate where in the Webdriver code, Internet Explorer
is launched?

Reported by fred.wang@free.fr on 2012-02-13 12:54:37

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

IE is launched from within the native code (C++) component of the IE driver. The actual
code where the browser is launched is in the LaunchBrowserProcess method in BrowserFactory.cpp[1],
at or about line 34.

[1] http://code.google.com/p/selenium/source/browse/trunk/cpp/IEDriver/BrowserFactory.cpp

Reported by james.h.evans.jr on 2012-02-13 15:43:54

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I just read Microsoft doc again. There are basically two ways to modify a feature control:

* Using CoInternetSetFeatureEnabled function: http://msdn.microsoft.com/en-us/library/ms537184%28v=vs.85%29.aspx#sec_featurecontrols_overview_functions.

* Editing the key registry (can be done manually with the command regedit): http://msdn.microsoft.com/en-us/library/ms537184%28v=vs.85%29.aspx#sec_fck_registry

Unfortunately, it does not seem that FEATURE_BROWSER_EMULATION can be specified using
the first method (I think it only works for boolean):

http://msdn.microsoft.com/en-us/library/ms537168%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/ms537169%28v=vs.85%29.aspx

so editing the key registry seems the only possible method here. Code can probably
be written to do that without user interaction. However, I think it will apply for
all IE instances.

Reported by fred.wang@free.fr on 2012-02-13 16:46:12

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I've been asked to share my workaround for this issue. The idea is to cast a Webdriver
object to a Selenium 1 object. Then to use keyboard events method of the Selenium 1
object. See the chooseInternetExplorerDocumentMode function here:

https://github.com/mathjax/MathJax-test/blob/master/testRunner/seleniumMathJax.py

Reported by fred.wang@free.fr on 2012-08-08 18:43:33

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Windows registry entry for FEATURE_BROWSER_EMULATION with settings for IE9/IE8 emulation
modes:

http://msdn.microsoft.com/en-us/library/ee330730(v=vs.85).aspx

Reported by jason31337 on 2012-10-16 17:48:59

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by barancev on 2013-05-19 18:04:51

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by luke.semerau on 2015-09-17 17:44:25

  • Labels added: Restrict-AddIssueComment-Commit

@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant