def test_search(self):
        # 运行网易云音乐
        autoit.run(self.cloudmusic_path)
        time.sleep(5)

        # 等待网易云音乐窗口激活
        autoit.win_wait_active(self.cloudmusic_title)

        # 按5下TAB切换至搜索框
        autoit.send("{TAB 5}")

        # 搜索歌曲
        autoit.send(self.song)
        time.sleep(1)

        # 按3下向下键选择第一首歌曲
        autoit.send("{DOWN 3}")
        time.sleep(1)

        # 按回车键播放歌曲
        autoit.send("{ENTER}")
        time.sleep(1)

        # 校验当前窗口标题是否含有搜索歌曲名
        title = autoit.win_get_title(self.cloudmusic_title)
        assert self.song in title, self.song.encode('utf-8') + ' not in ' + title.encode('utf-8')

        # 关闭窗口
        autoit.win_close(self.cloudmusic_title)
Beispiel #2
0
	def CheckWindow(self):
		while True:
			try:
				message = autoit.control_get_text("[CLASS:#32770]", "[CLASS:msctls_statusbar32; INSTANCE:1]")
				if message == "Nothing found":
					autoit.win_close("On-Demand Scan Progress")
					self.CheckProcess(False)
			except autoit.autoit.AutoItError:
				pass
Beispiel #3
0
def CheckWindow():
    while True:
        try:
            message = autoit.control_get_text(
                "[CLASS:#32770]", "[CLASS:msctls_statusbar32; INSTANCE:1]")
            if message == "Nothing found":
                autoit.win_close("On-Demand Scan Progress")
        except autoit.autoit.AutoItError:
            #os.system("powershell.exe Start-Process powershell.exe -ArgumentList C:\\Fuzzing\\ScanEngine\\Restart.ps1")
            CheckWindow()
Beispiel #4
0
def main():
    print("Enter main:")

    print("*************** t101:")

    autoit.run("notepad.exe")
    autoit.win_wait_active("[CLASS:Notepad]", 3)
    autoit.control_send("[CLASS:Notepad]", "Edit1", "hello world{!}")
    autoit.win_close("[CLASS:Notepad]")
    autoit.control_click("[Class:#32770]", "Button2")

    print("Level main:")
Beispiel #5
0
def CheckWindow():
    #autoit.run("C:\\Program Files (x86)\\McAfee\\VirusScan Enterprise\\x64\\Scan64.Exe")
    #autoit.win_wait_active("On-Demand Scan Progress",3)
    while True:
        try:
            message = autoit.control_get_text(
                "[CLASS:#32770]", "[CLASS:msctls_statusbar32; INSTANCE:1]")
            if message == "Nothing found":
                autoit.win_close("On-Demand Scan Progress")
        except autoit.autoit.AutoItError:
            os.system(
                "powershell.exe Start-Process powershell.exe -ArgumentList C:\\Fuzzing\\ScanEngine\\Restart.ps1"
            )
            CheckWindow()
Beispiel #6
0
 def win_close(cls, title, **kwargs):
     """
     call autoit.win_close
     关闭指定窗口.
     :return 1:成功; 0:窗口不存在.
     """
     return autoit.win_close(title, **kwargs)
Beispiel #7
0
 def close_xcap(self):
     autoit.win_activate("EPIX")
     autoit.win_close("EPIX")
     sleep(0.2)
     autoit.win_activate("EPIX")
     autoit.win_close("EPIX")
     sleep(0.2)
     autoit.win_activate("EPIX")
     autoit.win_close("EPIX")
     sleep(0.2)
     autoit.win_activate("EPIX")
     autoit.win_close("EPIX")
     autoit.win_activate(self._gui_title)
     sleep(5)
Beispiel #8
0
 def _export(self, type):
     ret_code = -1
     ret_value = None
     error_msg = ''
     if type == 'property':
         cid_refresh = self.cid_property_refresh
         cid_export = self.cid_property_export
         export_path = self.src_property_path
     elif type == 'entrust':
         cid_refresh = self.cid_entrust_refresh
         cid_export = self.cid_entrust_export
         export_path = self.src_entrust_path
     elif type == 'trade':
         cid_refresh = self.cid_trade_refresh
         cid_export = self.cid_trade_export
         export_path = self.src_trade_path
     else:
         error_msg = 'invalid type : %s' % (type)
         return (ret_code, ret_value, error_msg, self.export_log_path)
     ret_code = 1
     try:
         autoit.control_click(self.wid_main, cid_refresh)
         time.sleep(5)
         autoit.control_click(self.wid_main, cid_export)
         if autoit.win_wait(self.wid_export, timeout=6) == 1:
             ret_code = 2
             autoit.win_activate(self.wid_export)
             autoit.control_click(self.wid_export, self.cid_export_select)
             autoit.control_set_text(self.wid_export, self.cid_export_edit,
                                     export_path)
             autoit.control_click(self.wid_export, self.cid_export_ok)
             if autoit.win_wait(self.wid_notepad, timeout=5) == 1:
                 ret_code = 3
                 autoit.win_close(self.wid_notepad)
                 ret_code = 0
     except autoit.AutoItError:
         error_msg = traceback.format_exc()
     return (ret_code, ret_value, error_msg, self.export_log_path)
    def win_close_all(cls, title, limit_loop_time=0, **kwargs):
        """
        关闭所有匹配的指定窗口.
        limit_loop_time 限制循环的次数(0 表示无限制)
        :return [ close result, ...] close result(1:成功; 0:窗口不存在.)
        """
        wins = []

        if isinstance(limit_loop_time, (int, float)):
            limit_loop_time = int(limit_loop_time)
        elif isinstance(limit_loop_time,
                        basestring) and common.isNumber(limit_loop_time):
            try:
                limit_loop_time = int(limit_loop_time)
            except ValueError:
                limit_loop_time = int(float(limit_loop_time))
        else:
            limit_loop_time = 0

        current_time = 0
        key = "text"
        while True:
            current_time = current_time + 1
            if key in kwargs.keys():
                text = kwargs[key]
            else:
                text = ""
            if autoit.win_exists(title, text=text):
                result = autoit.win_close(title, **kwargs)
                wins.append(result)
            else:
                break

            if limit_loop_time != 0 and current_time > limit_loop_time:
                break

        return wins
Beispiel #10
0
 def close_window(self, sub_class=None):
     app_class = self.get_app_class(sub_class)
     print(app_class)
     autoit.win_close(app_class)
Beispiel #11
0
def close_pie():  # 关闭pie窗口
    autoit.win_close(u"PIE(教学版)")
    sleep(2)
    autoit.control_click("[class:#32770]", "Button2")  # 不保存工程
Beispiel #12
0
# -*- coding: utf-8 -*-

__author__ = 'Jace Xu'

import autoit

autoit.run("notepad.exe")
autoit.win_wait_active("[CLASS:Notepad]", 3)
autoit.control_send("[CLASS:Notepad]", "Edit1", "hello world{!}")
autoit.win_close("[CLASS:Notepad]")
autoit.control_click("[Class:#32770]", "Button2")
#NIU-RSA-PC1 - RSA SecurID Token /  RSA SecurID Token - the two titles my app has
# I believe the second one is what i need

rsa_path = "C:\\Program Files\\RSA SecurID Software Token\\SecurID.exe"
nc_path = "C:\\Program Files (x86)\\Juniper Networks\\Network Connect 7.4.0\\dsNetworkConnect.exe"

autoit.run(rsa_path)

active = autoit.win_wait_active(
    "NIU-RSA-PC1 - RSA SecurID Token",
    10)  # perfect, waits until second, real window opens and acts immediately!
title = autoit.win_get_title("[CLASS:QWidget]")
prccessid = autoit.win_get_process("NIU-RSA-PC1 - RSA SecurID Token")

time.sleep(0.5)

RSA_Text = autoit.win_get_text("[CLASS:QWidget]")

#autoit.control_send("NIU-RSA-PC1 - RSA SecurID Token", 'edit', "dodo")

# text = autoit.win_get_text("NIU-RSA-PC1 - RSA SecurID Token")

print(active, title, prccessid, RSA_Text)

autoit.win_close("NIU-RSA-PC1 - RSA SecurID Token")

# autoit.control_send("[CLASS:Notepad]", "Edit1", "hello world{!}")
# autoit.win_close("[CLASS:Notepad]")
# autoit.control_click("[Class:#32770]", "Button2")
expect(text).to(contain("3*10=30"))

# open menu
autoit.send("!a")

sleep(2)
autoit.send("{DOWN 3}")
autoit.send("{ENTER}")

autoit.win_wait_active(title=title_save)
autoit.control_set_text(title=title_save,
                        control="[CLASS:Edit; INSTANCE:1]",
                        control_text=new_file)

autoit.control_click(title_save, "[CLASS:Button; INSTANCE:1]")
sleep(3)

try:
    autoit.control_focus(confirm, "[CLASS:Button; INSTANCE:1]")
    autoit.control_click(confirm, "[CLASS:Button; INSTANCE:1]")
except:
    print("Tela de confirmar não encontrada!")

sleep(3)
autoit.win_wait_active(title=new_title)
result = autoit.win_get_title(title=new_title)
print(result)
expect(result).to(contain(new_title))
autoit.win_close(title=new_title)
Beispiel #15
0
def test_LME():
    autoit.run("C:\Program Files (x86)\Aldon\Aldon LM 6.6\Affiniti.exe")
    autoit.win_wait_active("[CLASS:Notepad]", 3)
    autoit.control_send("[CLASS:Notepad]", "Edit1", "hello world{!}")
    autoit.win_close("[CLASS:Notepad]")
    autoit.control_click("[Class:#32770]", "Button2")
Beispiel #16
0
def test_autoit_notePad():
    autoit.run("notepad.exe")
    autoit.win_wait_active("[CLASS:Notepad]", 3)
    autoit.control_send("[CLASS:Notepad]", "Edit1", "hello world{!}")
    autoit.win_close("[CLASS:Notepad]")
    autoit.control_click("[Class:#32770]", "Button2")
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 26 10:15:21 2020

@author: srira
"""

import autoit
import time

program = 'Winword.EXE'  # Find the winword.exe path in program files for MS Word
pdf = 'Pdf_name.pdf'

autoit.run(program + ' ' + pdf)
while True:
    try:

        autoit.control_send("[Class:OpusApp]", "_WwG1", "{F12}", 0)
        time.sleep(2)
        autoit.control_click("Save As", 'Button8')
        autoit.win_close("[CLASS:OpusApp]")
        break
    except:
        continue
Beispiel #18
0
 def close(self):
     '''
     :description 关闭指定窗口.
     :return 1:成功; 0:窗口不存在.
     '''
     return autoit.win_close(self.title, text=self.text)
Beispiel #19
0
	def close(self):
		"""关闭指定窗口"""
		return autoit.win_close(self.title, text=self.text)
    def test_search(self):
        # 运行网易云音乐
        autoit.run(self.cloudmusic_path)
        time.sleep(5)

        # 等待网易云音乐窗口激活
        autoit.win_wait_active(self.cloudmusic_title)

        # 按5下TAB切换至搜索框
        autoit.send("{TAB 5}")

        # 搜索歌曲
        autoit.send(self.song)
        time.sleep(1)

        # 按3下向下键选择第一首歌曲
        autoit.send("{DOWN 3}")
        time.sleep(1)

        # 按回车键播放歌曲
        autoit.send("{ENTER}")
        time.sleep(1)

        # 校验当前窗口标题是否含有搜索歌曲名
        title = autoit.win_get_title(self.cloudmusic_title)
        assert self.song in title, self.song.encode('utf-8') + ' not in ' + title.encode('utf-8')

        # 关闭窗口
autoit.win_close(self.cloudmusic_title)
Beispiel #21
0
	def POPUpKillerThread(self):
		print '[+] '+ datetime.now().strftime("%Y:%m:%d::%H:%M:%S") +' POP Up killer Thread started..'
		while True:
			try:
				# MS Word
				if "Word found unreadable" in autoit.win_get_text('Microsoft Word'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "You cannot close Microsoft Word because" in autoit.win_get_text('Microsoft Word'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "caused a serious error the last time it was opened" in autoit.win_get_text('Microsoft Word'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "Word failed to start correctly last time" in autoit.win_get_text('Microsoft Word'):
					autoit.control_click("[Class:#32770]", "Button2")
				if "This file was created in a pre-release version" in autoit.win_get_text('Microsoft Word'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "The program used to create this object is" in autoit.win_get_text('Microsoft Word'):
					autoit.control_click("[Class:#32770]", "Button1") 
				if "Word experienced an error trying to open the file" in autoit.win_get_text('Microsoft Word'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "experienced an error trying to open the file" in autoit.win_get_text('Microsoft Word'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "Word was unable to read this document" in autoit.win_get_text('Microsoft Word'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "The last time you" in autoit.win_get_text('Microsoft Word'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "Safe mode could help you" in autoit.win_get_text('Microsoft Word'):
					autoit.control_click("[Class:#32770]", "Button2")
				if "You may continue opening it or perform" in autoit.win_get_text('Microsoft Word'):	
					autoit.control_click("[Class:#32770]", "Button2")  # Button2 Recover Data or Button1 Open
				#Outlook
				if "Safe mode" in autoit.win_get_text('Microsoft Outlook'):	
					autoit.control_click("[Class:#32770]", "Button2")  # Button2 Recover Data or Button1 Open
				if "Your mailbox has been" in autoit.win_get_text('Microsoft Exchange'):	
					autoit.control_click("[Class:#32770]", "Button2")  # Button2 Recover Data or Button1 Open
				
				# MS Excel 
				if "Word found unreadable" in autoit.win_get_text('Microsoft Excel'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "You cannot close Microsoft Word because" in autoit.win_get_text('Microsoft Excel'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "caused a serious error the last time it was opened" in autoit.win_get_text('Microsoft Excel'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "Word failed to start correctly last time" in autoit.win_get_text('Microsoft Excel'):
					autoit.control_click("[Class:#32770]", "Button2")
				if "This file was created in a pre-release version" in autoit.win_get_text('Microsoft Excel'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "The program used to create this object is" in autoit.win_get_text('Microsoft Excel'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "because the file format or file extension is not valid" in autoit.win_get_text('Microsoft Excel'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "The file you are trying to open" in autoit.win_get_text('Microsoft Excel'):	
					autoit.control_click("[Class:#32770]", "Button1")
				if "The file may be corrupted" in autoit.win_get_text('Microsoft Excel'):
					autoit.control_click("[Class:#32770]", "Button2")
				if "The last time you" in autoit.win_get_text('Microsoft Excel'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "We found" in autoit.win_get_text('Microsoft Excel'):
					autoit.control_click("[Class:#32770]", "Button1")
					
				#PPT
				if "The last time you" in autoit.win_get_text('Microsoft PowerPoint'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "PowerPoint found a problem with content"  in autoit.win_get_text('Microsoft PowerPoint'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "read some content" in autoit.win_get_text('Microsoft PowerPoint'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "Sorry" in autoit.win_get_text('Microsoft PowerPoint'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "PowerPoint" in autoit.win_get_text('Microsoft PowerPoint'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "is not supported" in autoit.win_get_text('SmartArt Graphics'):
					autoit.control_click("[Class:#32770]", "Button2")
				if "Safe mode" in autoit.win_get_text('Microsoft PowerPoint'):	
					autoit.control_click("[Class:#32770]", "Button2")  # Button2 Recover Data or Button1 Open
					
				# Outlook
				
				# XPS Viewer
				if "Close" in autoit.win_get_text('XPS Viewer'):
					autoit.control_click("[Class:#32770]", "Button1")
				if "XPS" in autoit.win_get_text('XPS Viewer'):
					autoit.control_click("[Class:#32770]", "Button1")
				autoit.win_close('[CLASS:bosa_sdm_msword]')
			except:
				pass
Beispiel #22
0
#! /usr/bin/env python2
# coding=utf-8

import autoit
import time

autoit.run("notepad.exe")
time.sleep(2)
autoit.win_activate(u"无标题 - 记事本")
autoit.send("{LSHIFT}")
time.sleep(2)
autoit.send("#Process finished with exit code 0.", 1)
time.sleep(2)
autoit.win_close(u"无标题 - 记事本")
autoit.win_activate(u"记事本")
time.sleep(2)
autoit.control_click(u"记事本", u"保存(&S)")
time.sleep(2)
autoit.win_activate(u"另存为")
autoit.control_set_text(u"另存为", "[CLASS:Edit; INSTANCE:1]", "myTest.py")
time.sleep(2)
autoit.control_click(u"另存为", u"保存(&S)")
Beispiel #23
0
    def upload(self,path,date,h,m,ap):
        try:
            self.driver.find_elements_by_class_name('rwb8dzxj')[2].click() #create post button
            time.sleep(1)
            self.driver.find_elements_by_class_name('rwb8dzxj')[45].click() #instagram feed button
            time.sleep(2)
            element=self.driver.find_elements_by_class_name('_4ik4')[9+self.config['pageindex']] #page click
            self.driver.execute_script("arguments[0].click();",element)
            #caption
            element=self.driver.find_elements_by_class_name('_1mf')[0]
            caption=""
            if len(self.captions):
                caption=self.captions[str(random.randint(0,len(self.captions)-1))]
            clipboard.copy(caption)
            element.send_keys(Keys.CONTROL, 'v')
            self.driver.find_elements_by_class_name('_82ht')[0].click()
            # self.driver.find_element_by_xpath('/html/body/div[6]/div/div/div/div[2]/div[1]/div/div[5]/div/div/div/span').click() #file upload button
            time.sleep(1)
            #Selenium only works on browser, 'upload window' is OS window, so i used autoit to control it.
            _attempt=4
            while _attempt:
                try:
                    self.driver.find_elements_by_class_name('_m')[0].click()
                    time.sleep(1)
                    autoit.win_activate("Open")
                    break
                except:
                    _attempt-=1

            autoit.control_send("Open","Edit1",path)
            autoit.control_send("Open","Edit1","{ENTER}")
            time.sleep(1)
            self.driver.find_elements_by_class_name('_8122')[0].click()

            self.driver.find_elements_by_class_name('_kx6')[1].click()
            self.driver.find_elements_by_class_name('_58al')[1].click()
            self.driver.find_elements_by_class_name('_58al')[1].send_keys(date) #set date
            #set hour
            element=self.driver.find_elements_by_class_name('_4nx3')[0]
            actions=ActionChains(self.driver)
            actions.move_to_element(element).click().send_keys(h).perform()
            #set minute
            element=self.driver.find_elements_by_class_name('_4nx3')[1]
            actions=ActionChains(self.driver)
            actions.move_to_element(element).click().send_keys(m).perform()
            #set AM/PM
            element=self.driver.find_elements_by_class_name('_4nx3')[2]
            actions.move_to_element(element).click().send_keys(ap).perform()
            self.driver.find_elements_by_class_name('_43rm')[1].click()   #schedule button 
            time.sleep(5)
            if os.path.splitext(path)[1]=='.mp4':
                time.sleep(5)
            self.attempt=15
        except KeyboardInterrupt:
            main()
        except Exception as e:
            print(colors["red"],e,sep="")
            self.attempt-=1
            if autoit.win_exists('Open'):
                autoit.win_close('Open')
            if self.attempt:
                self.driver.get(igurl)
                time.sleep(3)
                self.upload(self.getpost(),date,h,m,ap)
            else:
                self.err()