Loading ...
Sorry, an error occurred while loading the content.

226updated notepad.pl example

Expand Messages
  • Danny Faught
    Jun 3, 2003
      I'm learning Win32::GuiTest to use as an example in my perl scripting
      tutorial at the Software Test Automation Conference. My first project
      was modifying eg/notepad.pl so it uses WaitWindow for synchronization
      instead of sleep.

      Was it the intention for this example to show simple sleep
      synchronization? If so, we could add some comments explaining that
      there's a better way to be learned elsewhere. If not, feel free to
      adopt the code below. Who knows, it might even work. :-)

      --------------------------------------------------
      system("start notepad.exe");

      if (Win32::GuiTest::WaitWindow(qr/^Untitled - Notepad$/, 10) == 0) {
      die "Can't find Notepad window";
      }
      Win32::GuiTest::SendKeys("If you're reading this inside notepad,\n");
      Win32::GuiTest::SendKeys("we might consider this test succesful.\n");
      Win32::GuiTest::SendKeys("Now I'll send notepad an ALT{+}F4 to close\n");
      Win32::GuiTest::SendKeys("it. Please wait.......");
      sleep 1;
      Win32::GuiTest::SendKeys(".");
      sleep 1;
      Win32::GuiTest::SendKeys(".");
      sleep 1;
      Win32::GuiTest::SendKeys(".");
      Win32::GuiTest::SendKeys("%{F4}");
      if (Win32::GuiTest::WaitWindow(qr/^Notepad$/, 10) == 0) {
      die "Can't find Notepad dialog";
      }
      Win32::GuiTest::SendKeys("{TAB}{ENTER}");
      --------------------------------------------------

      --
      Danny R. Faught
      Tejas Software Consulting
      -> subscribe to Open Testware Reviews -
      http://tejasconsulting.com/open-testware/
    • Show all 2 messages in this topic