Skip to Content

More and more is that necessary in automation processes to combine different kinds of UIs in one scenario. One example could be a WebDynpro in the browser with the possibility to open a SAP GUI for Windows inplace. To handle this case you can use Selenium WebDriver and SAP GUI Scripting. But if you use Internet Explorer 11 as browser, in this constellation, it is also necessary to set the protected mode of all zones equal, otherwise the automation process was aborted with an error message of the WebDriver. So it is necessary that the automation engineer focused his pay attention also on the customizing. The customizing of the browser is part of the automation process. It must be ensured that the settings are correct.

To combine this requirement with automated business process you can use AutoIt. It offers excellent possibilities to handle those requirements. You can embed AutoIt seamless in your automation process. Here an example to set the protected mode of all zones in IE 11 with AutoIt.

;-Begin-----------------------------------------------------------------

  ;-Directives----------------------------------------------------------
  AutoItSetOption("MustDeclareVars", 1)
  AutoItSetOption("WinTitleMatchMode", 4)

  ;-Sub SetIEProtectedMode----------------------------------------------
  Func SetIEProtectedMode($Mode = 0)

    Local $hWnd, $i, $hIESec, $SecMode, $Enabled, $hDlgWarn

    ShellExecute("inetcpl.cpl")
    $hWnd = WinWait("[TITLE:Eigenschaften von Internet; CLASS:#32770]", _
      "", 5)
    If $hWnd = 0 Then
      Return
    EndIf
    Send("^{TAB}")
    Sleep(250)
    $hIESec = ControlGetHandle($hWnd, "", "[TEXT:Sicherheit; CLASS:#32770]")
    For $i = 1 To 4
      ControlFocus($hIESec, "", "[TEXT:Zone von Webinhalten auswählen, " & _
        "um Einstellungen anzugeben.; CLASS:SysListView32]")
      Send("{RIGHT}")
      $SecMode = ControlCommand($hIESec, "", "[TEXT:&Geschützten Modus " & _
        "aktivieren (erfordert IE-Neustart); CLASS:Button]", "IsChecked")
      If $Mode = 0 And $SecMode = 1 Then
        ControlCommand($hIESec, "", "[TEXT:&Geschützten Modus " & _
          "aktivieren (erfordert IE-Neustart); CLASS:Button]", "UnCheck")
      ElseIf $Mode = 1 And $SecMode = 0 Then
        ControlCommand($hIESec, "", "[TEXT:&Geschützten Modus " & _
          "aktivieren (erfordert IE-Neustart); CLASS:Button]", "Check")
      EndIf
      Sleep(250)
    Next
    $Enabled = ControlCommand($hWnd, "", "[TEXT:Ü&bernehmen; CLASS:Button]", _
      "IsEnabled")
    If $Enabled = 1 Then
      Send("!b")
      $hDlgWarn = WinWait("[TITLE:Warnung; CLASS:#32770]", "", 2)
      If $hDlgWarn <> 0 Then
        Send("{ENTER}")
        Sleep(250)
      EndIf
    EndIf
    ControlClick($hWnd, "", "[TEXT:OK; CLASS:Button]")

  EndFunc

  ;-Sub Main------------------------------------------------------------
  Func Main()
    SetIEProtectedMode()
  EndFunc

  ;-Main----------------------------------------------------------------
  Main()

;-End-------------------------------------------------------------------

As you can see is it in the highest degree language dependent. I identify the controls based on its texts. For a better orientation here an image of the IE properties dialog of a German localizised Windows version. Each control I used in the code is marked with a red frame. Also you can find the line number where I used the control in the code.

This example is a good basis for further approaches of this kind. Also shows this example very clearly that an automation engineer has to consider many conditions. In this case the browser, the SAP GUI for Windows and last but not least the OS. We have to think outside the box and combine different technics with different languages. The required diversity is a great challenge.

Enjoy it.

Cheers
Stefan

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply