コード例 #1
0
# if you are putting your test script folders under {git project folder}/tests/, it will work fine.
# otherwise, you either add it to system path before you run or hard coded it in here.
sys.path.append(sys.argv[2])
import browser
import common
import gdoc

com = common.General()
chrome = browser.Chrome()
gd = gdoc.gDoc()

chrome.clickBar()
chrome.enterLink(sys.argv[3])
sleep(5)
gd.wait_for_loaded()

type("Answer: Depending on how one distinguishes a different Bible version from a revision of an existing Bible version, \
there are as many as 50 different English versions of the Bible. The question then arises: Is there really a need for \
so many different English versions of the Bible? The answer is, of course, no, there is no need for 50 different English \
versions of the Bible. This is especially true considering that there are hundreds of languages into which the entire Bible \
has not yet been translated. At the same time, there is nothing wrong with there being multiple versions of the Bible in a language. \
In fact, multiple versions of the Bible can actually be an aid in understanding the message of the Bible.")
type(Key.ENTER)
type(Key.ENTER)
type("There are two primary reasons for the different English Bible versions. (1) Over time, the English language changes/develops, \
making updates to an English version necessary. If a modern reader were to pick up a 1611 King James Version of the Bible, \
he would find it to be virtually unreadable. Everything from the spelling, to syntax, to grammar, to phraseology is very different. \
Linguists state that the English language has changed more in the past 400 years than the Greek language has changed in the past 2,000 years. \
Several times in church history, believers have gotten ?used? to a particular Bible version and become fiercely loyal to it, \
resisting any attempts to update/revise it. This occurred with the Septuagint, the Latin Vulgate, and more recently, the King James \
Version. Fierce loyalty to a particular version of the Bible is illogical and counterproductive. When the Bible was written, \
コード例 #2
0
    def run(self):
        # Disable Sikuli action and info log
        self.common.infolog_enable(False)
        delay = self.common.find_key_type_delay()

        chrome = browser.Chrome()
        fb = facebook.facebook()

        chrome.clickBar()
        chrome.enterLink(self.INPUT_TEST_TARGET)
        fb.wait_for_loaded()

        sleep(2)
        _, _, obj = fb.focus_comment_box()
        sample1_fp = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH,
                                  self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME)
        sample2_fp = os.path.join(
            self.INPUT_IMG_SAMPLE_DIR_PATH,
            self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME.replace(
                'sample_1', 'sample_2'))

        sleep(2)
        capture_width = int(self.INPUT_RECORD_WIDTH)
        capture_height = int(self.INPUT_RECORD_HEIGHT)

        # Customized Region
        customized_region_name_start = 'start'
        customized_region_name_end = 'end'

        # part region of search suggestion list
        compare_area = self.tuning_region(obj,
                                          x_offset=45,
                                          y_offset=25,
                                          w_offset=190,
                                          h_offset=30)
        self.set_override_region_settings(customized_region_name_start,
                                          compare_area)
        self.set_override_region_settings(customized_region_name_end,
                                          compare_area)

        t1 = time.time()
        capimg1 = capture(0, 0, capture_width, capture_height)

        # Reference from https://en.wikipedia.org/wiki/Lorem_ipsum
        # extract 100 chars from Lorem ipsum text and filter characters which will affect result, e.g., i, j, and l
        char_str = "orempsumdorstametconsecteturadpscngetsedoeusmodtemporncduntutaboretdoremagnaquatenmadmnvenamqusnoexe"
        self.common.system_print('Type char')
        self.common.delayed_type(char_str, 0.1, delay)

        sleep(1)
        t2 = time.time()
        capimg2 = capture(0, 0, capture_width, capture_height)
        self.common.updateJson({
            't1': t1,
            't2': t2
        }, self.INPUT_TIMESTAMP_FILE_PATH)
        shutil.move(
            capimg1,
            sample1_fp.replace(os.path.splitext(sample1_fp)[1], '.png'))
        shutil.move(
            capimg2,
            sample2_fp.replace(os.path.splitext(sample1_fp)[1], '.png'))
sys.path.append(sys.argv[2])
import browser
import common

com = common.General()
ch = browser.Chrome()

ch.enterLink(sys.argv[3])

sleep(2)
wait(Pattern('www_booking_com.png').similar(0.80), 60)

icon_loc = wait(Pattern('www_booking_com.png').similar(0.80), 60).getTarget()
x_offset = 0
y_offset = 150
inside_window = Location(icon_loc.getX() + x_offset,
                         icon_loc.getY() + y_offset)

mouseMove(inside_window)
ch.scroll_down(100)
コード例 #4
0
    def run(self):
        # Disable Sikuli action and info log
        com = common.General()
        com.infolog_enable(False)
        com.set_mouse_delay(0)

        # Prepare
        app = youtube.Youtube()
        sample1_file_path = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH,
                                         self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME)
        sample1_file_path = sample1_file_path.replace(
            os.path.splitext(sample1_file_path)[1], '.png')
        capture_width = int(self.INPUT_RECORD_WIDTH)
        capture_height = int(self.INPUT_RECORD_HEIGHT)

        # Launch browser
        my_browser = browser.Chrome()

        # Access link and wait
        my_browser.clickBar()
        my_browser.enterLink(self.INPUT_TEST_TARGET)
        app.wait_for_loaded()

        # Wait for stable
        sleep(2)

        # PRE ACTIONS
        app.close_ad()
        app.click_search_field()
        sleep(1)
        type('mozilla')
        app.wait_for_search_suggestion_loaded()
        com.loop_type_key(Key.DOWN, 2, 0.5)

        # Customized Region
        customized_region_name = 'end'
        type_area_component = [
            ['search_bar_win.png', 0, 0],
        ]
        type_area = self.find_match_region(type_area_component)
        self.set_override_region_settings(customized_region_name, type_area)

        # Record T1, and capture the snapshot image
        # Input Latency Action
        screenshot, t1 = app.il_type_key_down_search_suggestion(
            capture_width, capture_height)

        # In normal condition, a should appear within 100ms,
        # but if lag happened, that could lead the show up after 100 ms,
        # and that will cause the calculation of AIL much smaller than expected.
        sleep(0.1)

        # Record T2
        t2 = time.time()

        # POST ACTIONS
        sleep(1)

        # Write timestamp
        com.updateJson({'t1': t1, 't2': t2}, self.INPUT_TIMESTAMP_FILE_PATH)

        # Write the snapshot image
        shutil.move(screenshot, sample1_file_path)
    def run(self):
        # Disable Sikuli action and info log
        self.common.infolog_enable(False)
        self.common.set_mouse_delay(0)

        # Prepare
        app = facebook.facebook()
        sample1_fp = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH,
                                  self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME)
        sample1_fp = sample1_fp.replace(
            os.path.splitext(sample1_fp)[1], '.png')
        capture_width = int(self.INPUT_RECORD_WIDTH)
        capture_height = int(self.INPUT_RECORD_HEIGHT)

        # Launch browser
        chrome = browser.Chrome()

        # Access link and wait
        chrome.clickBar()
        chrome.enterLink(self.INPUT_TEST_TARGET)
        app.wait_for_loaded()

        # Wait for stable
        sleep(2)

        # PRE ACTIONS
        app.click_right_panel_contact(similarity=0.85)
        sleep(2)
        pattern, obj = app.wait_for_close_button_loaded()

        # Customized Region
        customized_region_name = 'end'

        # part region of search suggestion list
        compare_area = self.tuning_region(obj,
                                          x_offset=-145,
                                          w_offset=145,
                                          h_offset=305)
        self.set_override_region_settings(customized_region_name, compare_area)

        # Record T1, and capture the snapshot image
        # Input Latency Action
        loc, screenshot, t1 = app.il_click_close_chat_tab(
            capture_width, capture_height)

        # In normal condition, a should appear within 100ms,
        # but if lag happened, that could lead the show up after 100 ms,
        # and that will cause the calculation of AIL much smaller than expected.
        sleep(0.1)

        # Record T2
        t2 = time.time()

        # POST ACTIONS
        sleep(2)
        app.wait_pattern_for_vanished(pattern=pattern, similarity=0.9)

        # Write timestamp
        self.common.updateJson({
            't1': t1,
            't2': t2
        }, self.INPUT_TIMESTAMP_FILE_PATH)

        # Write the snapshot image
        shutil.move(screenshot, sample1_fp)
コード例 #6
0
    def run(self):
        # Disable Sikuli action and info log
        com = common.General()
        com.infolog_enable(False)
        com.set_mouse_delay(0)

        # Prepare
        app = amazon.Amazon()
        sample1_file_path = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH,
                                         self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME)
        sample1_file_path = sample1_file_path.replace(
            os.path.splitext(sample1_file_path)[1], '.png')
        capture_width = int(self.INPUT_RECORD_WIDTH)
        capture_height = int(self.INPUT_RECORD_HEIGHT)

        # Launch browser
        my_browser = browser.Chrome()

        # Access link and wait
        my_browser.clickBar()
        my_browser.enterLink(self.INPUT_TEST_TARGET)
        _, obj = app.wait_for_logo_loaded()

        # Wait for stable
        sleep(2)

        # PRE ACTIONS
        app.click_search_field()

        # user function's related position from logo
        pattern = capture(obj.x + 160, obj.y + 50, obj.w + 100, obj.h)
        sleep(1)
        type('m')
        com.system_print('Wait temp pattern {} vanished.'.format(pattern))
        app.wait_pattern_for_vanished(pattern=pattern)
        com.loop_type_key(Key.DOWN, 2, 0.5)

        # Customized Region
        customized_region_name = 'end'

        # part region of search suggestion list
        compare_area = self.tuning_region(obj,
                                          x_offset=160,
                                          w_offset=200,
                                          h_offset=50)
        self.set_override_region_settings(customized_region_name, compare_area)
        sleep(2)

        # Record T1, and capture the snapshot image
        # Input Latency Action
        screenshot, t1 = app.il_type_key_down_search_suggestion(
            capture_width, capture_height)

        # In normal condition, a should appear within 100ms,
        # but if lag happened, that could lead the show up after 100 ms,
        # and that will cause the calculation of AIL much smaller than expected.
        sleep(0.1)

        # Record T2
        t2 = time.time()

        # POST ACTIONS
        sleep(1)

        # Write timestamp
        com.updateJson({'t1': t1, 't2': t2}, self.INPUT_TIMESTAMP_FILE_PATH)

        # Write the snapshot image
        shutil.move(screenshot, sample1_file_path)
コード例 #7
0
    def run(self):
        # Disable Sikuli action and info log
        com = common.General()
        com.infolog_enable(False)
        com.set_mouse_delay(0)

        # Prepare
        app = gslide.gSlide()
        sample1_file_path = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH,
                                         self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME)
        sample1_file_path = sample1_file_path.replace(
            os.path.splitext(sample1_file_path)[1], '.png')
        capture_width = int(self.INPUT_RECORD_WIDTH)
        capture_height = int(self.INPUT_RECORD_HEIGHT)

        # Launch browser
        my_browser = browser.Chrome()

        # Access link and wait
        my_browser.clickBar()
        my_browser.enterLink(self.INPUT_TEST_TARGET)
        app.wait_for_loaded()

        # Wait for stable
        sleep(2)

        # PRE ACTIONS
        app.click_content_text_box()
        sleep(0.5)

        # Customized Region
        customized_region_name = 'end'
        type_area = self.find_match_region(app.GSLIDE_TXT_IMG_SHAPE_ICON,
                                           similarity=0.75)
        modified_area = self.tuning_region(type_area,
                                           x_offset=-60,
                                           w_offset=50,
                                           h_offset=250)
        self.set_override_region_settings(customized_region_name,
                                          modified_area)

        # Record T1, and capture the snapshot image
        # Input Latency Action

        screenshot, t1 = app.il_type('a', capture_width, capture_height)

        # In normal condition, a should appear within 100ms,
        # but if lag happened, that could lead the show up after 100 ms,
        # and that will cause the calculation of AIL much smaller than expected.
        sleep(0.1)

        # Record T2
        t2 = time.time()

        # POST ACTIONS

        # Write timestamp
        com.updateJson({'t1': t1, 't2': t2}, self.INPUT_TIMESTAMP_FILE_PATH)

        # Write the snapshot image
        shutil.move(screenshot, sample1_file_path)
コード例 #8
0
    def run(self):
        # Disable Sikuli action and info log
        self.common.infolog_enable(False)
        Settings.MoveMouseDelay = 0

        # Prepare
        app = gmail.gMail()
        sample1_file_path = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH,
                                         self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME)
        sample1_file_path = sample1_file_path.replace(
            os.path.splitext(sample1_file_path)[1], '.png')
        capture_width = int(self.INPUT_RECORD_WIDTH)
        capture_height = int(self.INPUT_RECORD_HEIGHT)

        # Launch browser
        my_browser = browser.Chrome()

        # Access link and wait
        my_browser.clickBar()
        my_browser.enterLink(self.INPUT_TEST_TARGET)
        app.wait_for_loaded()

        # Wait for stable
        sleep(2)

        # PRE ACTIONS
        app.click_first_mail()
        sleep(2)
        app.click_reply_btn()
        sleep(2)

        # Customized Region
        customized_region_name = 'end'
        _, reply_btn_region = app.wait_for_component_display(
            app.GMAIL_TYPE_FOR_REPLY, similarity=0.8)
        type_area = self.tuning_region(reply_btn_region,
                                       x_offset=12,
                                       h_offset=50)
        self.set_override_region_settings(customized_region_name, type_area)
        sleep(2)

        # Record T1, and capture the snapshot image
        # Input Latency Action
        screenshot, t1 = app.il_type('a',
                                     capture_width,
                                     capture_height,
                                     wait_component=(app.GMAIL_TYPE_FOR_REPLY +
                                                     app.GMAIL_SEND))

        # In normal condition, a should appear within 100ms,
        # but if lag happened, that could lead the show up after 100 ms,
        # and that will cause the calculation of AIL much smaller than expected.
        sleep(0.1)

        # Record T2
        t2 = time.time()

        # POST ACTIONS
        sleep(2)
        app.click_reply_del_btn()

        # Write timestamp
        self.common.updateJson({
            't1': t1,
            't2': t2
        }, self.INPUT_TIMESTAMP_FILE_PATH)

        # Write the snapshot image
        shutil.move(screenshot, sample1_file_path)
コード例 #9
0
    def run(self):
        sample1_fp = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH,
                                  self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME)
        sample1_file_path = sample1_fp.replace(
            os.path.splitext(sample1_fp)[1], '.png')
        capture_width = int(self.INPUT_RECORD_WIDTH)
        capture_height = int(self.INPUT_RECORD_HEIGHT)

        # Disable Sikuli action and info log
        self.common.infolog_enable(False)
        Settings.MoveMouseDelay = 0
        setAutoWaitTimeout(10)

        chrome = browser.Chrome()
        fb = facebook.facebook()

        chrome.clickBar()
        chrome.enterLink(self.INPUT_TEST_TARGET)
        fb.wait_for_loaded()
        fb.wait_for_messenger_loaded()
        sleep(2)

        self.common.select_all()
        self.common.delete()
        sleep(2)

        # Customized Region
        customized_region_name = 'end'
        type_area_component = [
            ['facebook_type_message_win.png', 0, 0],
        ]

        # Getting the Type Area Region from Like Btn.
        #
        # X = 0 (offset = "-btn.x")
        # <==============================>
        # -------------------------------------  ^ Y offset = -30
        # | Write a reply ...                 |  |
        # |                                   |  | H offset = +30
        # | O T H E R B T N               Btn |  |
        # -------------------------------------  v
        #
        # or
        #
        # X = 0 (offset = "-btn.x")
        # <==========================================>
        # --------------------------------------------------  ^ Y offset = -30
        # |              Some messages                     |  |
        # |------------------------------------------------|  | H offset = +30
        # | Write a reply ...         O T H E R B T N  Btn |  |
        # --------------------------------------------------  v

        type_area_btn = self.find_match_region(type_area_component,
                                               similarity=0.80)
        type_area = self.tuning_region(type_area_btn, y_offset=-30)
        self.set_override_region_settings(customized_region_name, type_area)

        # Record T1, and capture the snapshot image
        # Input Latency Action
        screenshot, t1 = fb.il_type(
            'a',
            capture_width,
            capture_height,
            wait_component=fb.FACEBOOK_MESSENGER_HEADER)

        # In normal condition, a should appear within 200ms,
        # but if lag happened, that could lead the show up after 200 ms,
        # and that will cause the calculation of AIL much smaller than expected.
        sleep(0.2)

        # Record T2
        t2 = time.time()

        self.common.updateJson({
            't1': t1,
            't2': t2
        }, self.INPUT_TIMESTAMP_FILE_PATH)
        shutil.move(screenshot, sample1_file_path)
    def run(self):
        # Disable Sikuli action and info log
        com = common.General()
        com.infolog_enable(False)
        com.set_mouse_delay(0)
        delay = com.find_key_type_delay()

        # Prepare
        app = amazon.Amazon()
        sample1_file_path = os.path.join(self.INPUT_IMG_SAMPLE_DIR_PATH,
                                         self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME)
        sample2_file_path = os.path.join(
            self.INPUT_IMG_SAMPLE_DIR_PATH,
            self.INPUT_IMG_OUTPUT_SAMPLE_1_NAME.replace(
                'sample_1', 'sample_2'))
        sample1_file_path = sample1_file_path.replace(
            os.path.splitext(sample1_file_path)[1], '.png')
        sample2_file_path = sample2_file_path.replace(
            os.path.splitext(sample2_file_path)[1], '.png')
        capture_width = int(self.INPUT_RECORD_WIDTH)
        capture_height = int(self.INPUT_RECORD_HEIGHT)

        # Launch browser
        my_browser = browser.Chrome()

        # Access link and wait
        my_browser.clickBar()
        my_browser.enterLink(self.INPUT_TEST_TARGET)
        app.wait_for_search_button_loaded()

        # Wait for stable
        sleep(2)

        # PRE ACTIONS
        app.click_search_field()
        sleep(1)

        # Customized Region
        customized_region_name_start = 'start'
        customized_region_name_end = 'end'
        _, type_area = app.wait_for_component_display(app.AMAZON_SEARCH_BAR,
                                                      similarity=0.9)
        self.set_override_region_settings(customized_region_name_start,
                                          type_area)
        self.set_override_region_settings(customized_region_name_end,
                                          type_area)

        t1 = time.time()
        capimg1 = capture(0, 0, capture_width, capture_height)

        # Reference from https://en.wikipedia.org/wiki/Lorem_ipsum
        # extract 100 chars from Lorem ipsum text and filter characters which will affect result, e.g., i, j, and l
        char_str = "orempsumdorstametconsecteturadpscngetsedoeusmodtemporncduntutaboretdoremagnaquatenmadmnvenamqusnoexe"
        com.system_print('Type char')
        com.delayed_type(char_str, 0.1, delay)
        sleep(1)

        # Record T2
        t2 = time.time()

        # POST ACTIONS
        capimg2 = capture(0, 0, capture_width, capture_height)

        # Write timestamp
        com.updateJson({'t1': t1, 't2': t2}, self.INPUT_TIMESTAMP_FILE_PATH)

        # Write the snapshot image
        shutil.move(capimg1, sample1_file_path)
        shutil.move(capimg2, sample2_file_path)