Posts Tagged ‘Windows’


UPDATED: Nov 11th, 09 , changes: added python info

I have been struggling to find a way to get around selenium’s onload deficiencies. I tried all sorts of ways to hack up my script, but alas it mostly ended up in turmoil. Onload is one of the main ways most developers use to make sure certain actions happen in code, and my entire content bed was about go into flames before I found the light at the end of the tunnel. A magical gift from the heavens known as AutoIt saved me from a timely demise…

All retardedness aside… (sarcasm)..

AutoIt really did solve this problem for me. It may not work so well for others.. it depends on your situation. For me a simply wanted to close a popup window after it loaded from a different windows onload and then click the popup’s confirmation’s Ok button. Then close the original window that started all the madness…

The cool thing about running the code below is that it just runs as a daemon of sorts in the background waiting for some unruley popup to be struck down with Wrath of Kahn, plus it can also test for popups with different names. I am hoping I can do some sweet regex stuff, otherwise, life may prove difficult. In any case here is my AutoIt script:

While True
   If WinWait('Name of the final Popup', '', 1) == 1 Then
     ;Wait for page to load if found
     ;Close Page
     ;Confirm Dialog
     ;Close Lanucher Page
   ;Let another thread have a turn

Now, lets say you want the above to be directly embedded into your script rather than have it constantly running externally. I personally use python for my Selenium scripting so in python you can do the follwoing (which is the equivalent of the above script).

from selenium import selenium
import unittest, re, time
from datetime import date, datetime
from xml.dom import minidom
from win32com.client import Dispatch

# Auto it window closing stuff
def autoItCloseWindows(self):
   auto = Dispatch("AutoItX3.Control")
   #Your Popup Name Here is the name of the window...
   #I did this because different windows could open for my project
   if (auto.WinWait("Your Popup Name Here", "", 1) == 1):
      # chill
      # close window
      # wait
      # confirm dialog box
      # close the launcher window

To run this script you mainly need selenium, time, autoit3 and win32 dispatch. To download win32 stuff for python click here. Another thing to note is that this will only work for windows. There are similar solutions available for *nix. If you are using a mac to do things like this it is probably a waste of your mac ha, but there are also similar solutions.

Good luck oh weary travelers…


So I made this last semester with a group for my game design classes. Although there was not much “design” to the game we spent a ton of time working on our own proprietary game engine. We did not really fine tune or polish it and make a full on story and game, but looking back at this engine it really is quite a nice accomplishment. Check out the video below! We built it entirely on XNA with no other libraries. We handled collision ourselves! Also developed a quad tree structure to calculate whether something should appear on the screen or not this feature loaded things in and out of memory. Also we developed a power up system. In this video you can see it as us collecting “coins” at the beginning, but it is a little hard to see. Sorry for the somewhat poor quality on the video. I tried to record it using screen capture, but nothing could keep up at 60 (or even 30) frames per second, so i settled for my LG Dare’s Camera.