def _click_button(self, win): name = self.arg(1) try: win.click_button(name) except NotFoundException: Logger.add_error("Button(%s) not found. hwnd=%d" % (name, win.hwnd))
def _enter_text(self, win): pos = int(self.arg(1)) text = self.arg(2) try: win.enter_text(pos, text) except NotFoundException: Logger.add_error("Text control #%d not found" % pos)
def _select_custom_tree_control_item(self, win): try: pos = int(self.arg(1)) text = self.arg(2) win.select_custom_tree_control_item(pos, text) except NotFoundException: Logger.add_error("Custom tree control #%d item %s not found" % (pos, text))
def click_mouse(self, position): try: self._send_lbutton_click_to_window(position) Logger.add_result("Mouse clicked at (%d, %d)" % (position[0], position[1])) except NotFoundException: Logger.add_error("Mouse click failed")
def _select_combobox_item(self, win): try: pos = int(self.arg(1)) text = self.arg(2) win.select_combobox_item(pos, text) except NotFoundException: Logger.add_error("ComboBox control #%d item %s not found" % (pos, text))
def _close_dialog(self, win): win, name = self.find_win(win, "wxDialog", self.arg(1)) try: win.EndModal(wx.ID_CANCEL) except: Logger.add_error("Dialog(%s) not found" % name)
def _close_frame(self, win): win, name = self.find_win(win, "wxFrame", self.arg(1)) try: win.Destroy() except NotFoundException: Logger.add_error("Frame(%s) not found" % name)
def _clik_mouse(self, win): pos = self._position(win) try: win.click_mouse(pos) except NotFoundException: Logger.add_error("Mouse click at (%d, %d) failed" % (pos[0], pos[1]))
def _hide_frame(self, win): try: win, name = self.find_win(win, "wxFrame", self.arg(1)) win.Hide() except NotFoundException: Logger.add_error("Frame(%s) not found" % name)
def _select_menu(self, win): try: item_id = self._find_menu_item_id(win) win.click_menu_item(item_id) except NotFoundException: Logger.add_error("Menu not found")