Selenium + IE8: force IE8 compatibility view

后端 未结 2 657
别跟我提以往
别跟我提以往 2020-12-11 02:25

I\'m running Selenium in singleWindow mode and IE8.

If i start IE8 manually the IE8 mode is set, but when i launch it with Selenium, the mode set is IE7 using the co

相关标签:
2条回答
  • 2020-12-11 02:50

    I've given the question a +1 because it's a very good question -- it's not obvious how to do this, and if you need to test both modes, then it is a necessary thing to do.

    You could get the site to serve <meta http-equiv="X-UA-Compatible" content="IE=7" /> within the page when running the tests. This should force the output mode.

    Obviously, that's not ideal, because it means changing your code to produce the meta tag on demand. I'd normally consider it a bad thing if you're having to change the main codebase in to add code for the specific use of your test suite, but in this case I can't see any other solution.

    Given that we've decided to go down this path, you could write your code to accept a specified argument in the URL that triggers the meta tag to be served. The IE7 tests could then be written to send that URL argument.

    By the way, it's worth pointing out that IE8's IE7-compatibility mode is not 100% identical to IE7; it has its own quirks and bugs which are distinct from those of a real IE7 browser. For the most part it should be fine, but it's worth being aware of this if you're expecting your tests to confirm that the site works in IE7. See this blog post for more info

    0 讨论(0)
  • 2020-12-11 02:52

    I have some workarond solution for this, I use it regularly:


    In internet explorer goto: 1. Tools / Compatibility view settings. 2. At the Add website input textbox add your website url.


    Hope that helps, best regards,

    Peter Nadasi (HUN)

    0 讨论(0)
提交回复
热议问题