Change IE9 to IE8 with Selenium WebDriver in Ruby

我与影子孤独终老i 提交于 2019-12-06 06:16:38

If you want to tell the IE version during run time, you can use DesiredCapabilities.

  DesiredCapabilities ieCapabilities = null;
  ieCapabilities = DesiredCapabilities.internetExplorer();
  ieCapabilities.setBrowserName("internet explorer");
  ieCapabilities.setVersion("Version Number");
  driver = new InternetExplorerDriver(ieCapabilities);

For more info about DesiredCapabilities use this link http://code.google.com/p/selenium/wiki/DesiredCapabilities.

In the comments you said that i need both IE 8 and 9. Actually it is not possible, Windows currently supports to install only one IE version in a box. The IEDriver used the installed version of IE to launch.

If you want to use multiple version of IE to test then the better option to go with Windows Virtual Machines. You can talk with virtual machines by using the RemoteWebdriver instances.

Actually, this is currently not supported by Selenium WebDriver. There is currently an enhancement request for the IE modes to be implemented as a part of the DesiredCapabilities functionality referenced in the comment from Manigandan.

You can follow this enhancement request here: http://code.google.com/p/selenium/issues/detail?id=2564

Other possible solutions mentioned on the enhancement request is manipulating the FEATURE_BROWSER_EMULATION registry key (see http://msdn.microsoft.com/en-us/library/ee330730(v=vs.85).aspx ) or using keyboard commands to open Developer Tools and selecting the mode from there (I am not sure how well this solution would work, as the workaround in Python requires the WebDriver object to be cast as a Selenium 1.0 object).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!