How to use AutoIt to set Internet Explorer options?

875 Views Asked by At

I need to use AutoIt to change the emulation mode in Internet Explorer.

Basically I need to open the "developer tools" (F12), change the document mode to emulate IE 10.

AutoIt is up and running in my IDE (Eclipse). I already can open IE, what are my doubts:

  1. How can I simulate opening the debug options?

enter image description here

  1. How can I change the emulation version?

enter image description here

I just created a new instance of AutoIt and know how to open IE:

package autotioficial;

import java.io.File;

import com.jacob.com.LibraryLoader;

import autoitx4java.AutoItX;

public class App {

public static void main(String[] args) {

    File file = new File("lib", "jacob-1.18-x86.dll"); //path to the jacob dll
    System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());

    AutoItX x = new AutoItX();
    x.run("C:/Program Files (x86)/Internet Explorer/iexplore.exe");

   }

}
1

There are 1 best solutions below

4
On BEST ANSWER

I'd use keystrokes to do this:

x.send("{F12}") //go to developer mode
x.send("^8") //control-8 to go to Emulation tab
x.send("{TAB}") //select the first field (Document mode)
x.send("10") //set emulated version to E10

I checked manually, this works on Explorer 11. The change is not very persistent though, watch for browser history resets etc (http://appliedusers.ca/forums/index.php?topic=5330.0).

References:
https://www.autoitscript.com/autoit3/docs/functions/Send.htm
https://www.autoitscript.com/autoit3/docs/appendix/SendKeys.htm