Beispiel #1
0
 def click_lesson(self, lesson_name):
     lesson_win = Desktop(backend="uia").window(
         **self.configs['lesson_win']['id'])
     lesson_win.wait('visible', timeout=30)
     lessons = self.get_lesson_list(lesson_win)
     for lesson in lessons.keys():
         #self.logger.debug("Lesson: %s." % lesson)
         if lesson_name == lesson:
             if len(lessons) > 1:  # 单个课程,不需点击
                 lessons[lesson_name].click()
             dialog_confirm = lesson_win.window(
                 **self.configs['lesson_win']['confirm']['id'])
             dialog_confirm.window(
                 **self.configs['lesson_win']['confirm']['ok']).click()
             lesson_win.wait_not('visible', timeout=60)
         elif lesson_name in lesson and '\r\n(上课中...)' in lesson:
             self.logger.debug("%s is working." % lesson_name)
             lesson_win.window(
                 **self.configs['lesson_win']['exit']).click()  # 关闭
         elif len(lessons) == 1:  # 单个课程,且课程名称不匹配情况
             dialog_confirm = lesson_win.window(
                 **self.configs['lesson_win']['confirm']['id'])
             dialog_confirm.window(
                 **self.configs['lesson_win']['confirm']['ng']).click()
             lesson_win.wait_not('visible', timeout=60)
         else:
             self.logger.debug("%s in config doesnot exists." % lesson_name)
Beispiel #2
0
def mysql_installation():
    # Loading the app exe file from the directory.

    '''

    pywinauto dialogue select best name for the dialgoue combination. more details can be found here.

    https://pywinauto.readthedocs.io/en/latest/getting_started.html#attribute-resolution-magic
    https://pywinauto.readthedocs.io/en/latest/wait_long_operations.html

    :return:
    '''

    app = Application(backend="uia").start("setups/wampserver.exe")

    # selecting  the language dialogue box.
    Wizard = Desktop(backend='uia').Select_Setup_Language
    Wizard.OK.click_input()
    # app.InstallDialog.IAgreeRadioButton.wait('ready', timeout=30).click_input()

    Wizard2 = Desktop(backend='uia').Setup_Wampserver64
    Wizard2.i_accept_the_agreement.click_input()
    Wizard2.NextButton.click_input()
    Wizard2.NextButton.click_input()
    Wizard2.NextButton.click_input()
    Wizard2.Install.click_input()

    # waiting for open dialogue to be closed
    Wizard2.wait_not('visible')

    # After installation, start the application from the windows installed directory
    start_wamp()
    time.sleep(5)
    # setup the database. This batch file created database in the db MySQL and improt all the sql file data into it.
    os.startfile(os.getcwd() + '/setups/database.bat')
Beispiel #3
0
 def start_lesson(self, lesson_name):
     ''' 上课 '''
     # 点击【课程控制】
     self.main_win[self.configs['teachermain']['toolbar']
                   ['BtnLesson']].click()
     # 点击【上课】
     self.click_menu_btn(self.configs['teachermain']['LessonMenu']['Start'])
     # 点击相应课程
     self.click_lesson(lesson_name)
     lesson_win = Desktop(backend="uia").window(
         **self.configs['lesson_win']['id'])
     lesson_win.wait_not('visible', timeout=60)
Beispiel #4
0
from pywinauto import Desktop, Application

Application().start('explorer.exe "C:\\Program Files"')

# connect to another process spawned by explorer.exe
app = Application(backend="uia").connect(path="explorer.exe", title="Program Files")

app.ProgramFiles.set_focus()
common_files = app.ProgramFiles.ItemsView.get_item('Common Files')
common_files.right_click_input()
app.ContextMenu.Properties.invoke()

# this dialog is open in another process (Desktop object doesn't rely on any process id)
Properties = Desktop(backend='uia').Common_Files_Properties
Properties.print_control_identifiers()
Properties.Cancel.click()
Properties.wait_not('visible') # make sure the dialog is closed
Beispiel #5
0
from pywinauto import Desktop, Application

Application().start('explorer.exe "C:\\Program Files"')

# connect to another process spawned by explorer.exe
# Note: make sure the script is running as Administrator!
app = Application(backend="uia").connect(path="explorer.exe",
                                         title="Program Files")

app.ProgramFiles.set_focus()
common_files = app.ProgramFiles.ItemsView.get_item('Common Files')
common_files.right_click_input()
app.ContextMenu.Properties.invoke()

# this dialog is open in another process (Desktop object doesn't rely on any process id)
Properties = Desktop(backend='uia').Common_Files_Properties
Properties.print_control_identifiers()
Properties.Cancel.click()
Properties.wait_not('visible')  # make sure the dialog is closed