예제 #1
0
def run_page_scrapping(driver, file_name):
    elems = driver.find_elements_by_tag_name("img")
    for i in range(len(elems)):
        el = driver.find_elements_by_tag_name("img")[i]
        try:
            if el.get_attribute("alt") == "Expand section Click here to learn more:   | Terms Offered: Fall 2015":
                click(driver, el)
            finished = True
        except:
            import traceback; traceback.print_exc();
            import ipdb; ipdb.set_trace()
    with codecs.open("./2015-2016/{0}.html".format(file_name), "w", "utf-8") as f:
        f.write(driver.page_source)

    el = driver.find_element_by_name("NYU_CLS_DERIVED_BACK")
    try_counter = 0
    while try_counter < 10:
        try: 
            click(driver, el)
            break
        except:
            print("Retrying clicking back to subject button...")
            if try_counter == 9:
                import ipdb; ipdb.set_trace()
            try_counter += 1
예제 #2
0
def tansuo():
    while runFlag:
        screen = util.getScreen()
        # 设定目标,开始查找
        # 进入后
        want = util.imgs['tu']
        pts = util.action.locate(screen, want, 0)
        if not len(pts) == 0:
            msg = '%s-处于地图中\n' % (util.getTimeFormat())
            logMsg(log, msg)
            want = util.imgs['left']
            pts = util.action.locate(screen, want, 0)
            if not len(pts) == 0:
                right = (854, 527)
                right = util.action.cheat(right, 10, 10)
                pyautogui.click(right)
                t = random.randint(30, 60) / 100
                time.sleep(t)
                continue
            screen = util.getScreen()
            want = util.imgs['jian']
            pts = util.action.locate(screen, want, 0)
            if not len(pts) == 0:
                msg = '%s-点击小怪\n' % (util.getTimeFormat())
                logMsg(log, msg)
                xx = util.action.cheat(pts[0], 10, 10)
                pyautogui.click(xx)
            elif not util.click(screen, 'boss'):
                for i in ['queren', 'tuichu']:
                    screen = util.getScreen()
                    if util.click(screen, i):
                        msg = '%s-退出中\n' % (util.getTimeFormat())
                        logMsg(log, msg)
                        t = random.randint(15, 30) / 100
                        time.sleep(t)
                        break
            if util.checkMan():
                count = count + 3
                changeCost(cost, count)
            if (count >= PhysicalLimit) & (PhysicalLimit != 0):
                msg = '%s-已消耗体力-%d\n' % (util.getTimeFormat(), count)
                logMsg(log, msg)
                stop(log, Btn_start, Btn_stop)
        for i in ['28', 'tansuo', 'ying', 'jiangli', 'jixu', 'jujue']:
            screen = util.getScreen()
            result = util.click(screen, i)
            if result:
                t = random.randint(10, 20) / 100
                time.sleep(t)
                continue
            else:
                continue
예제 #3
0
def run_customized_action(driver):
    time.sleep(1)
    elems = driver.find_elements_by_css_selector("table.PSLEVEL3GRIDNBO a.SSSAZLINK")
    counter = 648
    for i in range(len(elems)):
        el = elems[counter]
        file_name = el.text.replace("\n", "").strip()
        file_name = file_name.replace("/", "-")
        print("\ncounter: {0}, course: {1}\n================".format(counter, file_name))
        click(driver, el)
        run_page_scrapping(driver, file_name)
        elems = driver.find_elements_by_css_selector("table.PSLEVEL3GRIDNBO a.SSSAZLINK")
        counter += 1
예제 #4
0
def huntu():
    while runFlag:
        for i in [
                'huntutiaozhan', 'huntujiesuan', 'huntujiangli',
                'huntujiesuan1', 'jiangli', 'jujue'
        ]:
            if util.click(i):
                time.sleep(random.randint(10, 20) / 100)
                continue
            else:
                continue
예제 #5
0
def jiejietupo():
    global runFlag, log, cost, PhysicalLimit, Btn_start, Btn_stop, count
    while runFlag:
        screen = util.getScreen()
        if util.click(screen, 'test'):
            count = count + 3
            changeCost(cost, count)
        if (count >= PhysicalLimit) & (PhysicalLimit != 0):
            msg = '%s-已消耗体力-%d\n' % (util.getTimeFormat(), count)
            logMsg(log, msg)
            stop(log, Btn_start, Btn_stop)
예제 #6
0
def yuling():
    while runFlag:
        for i in [
                'yulintiaozhan', 'huntujiesuan', 'huntujiangli',
                'huntujiesuan1', 'jiangli', 'jujue'
        ]:
            screen = util.getScreen()
            if util.click(screen, i):
                t = random.randint(10, 20) / 100
                time.sleep(t)
                continue
            else:
                continue
예제 #7
0
def yeyuanhuo():
    while runFlag:
        for i in [
                'yeyuanhuotiaozhan', 'yeyuanhuojiesuan', 'yeyuanhuojiangli',
                'yeyuanhuojiesuan1', 'jiangli', 'jujue'
        ]:
            screen = util.getScreen()
            result = util.click(screen, i)
            if result:
                t = random.randint(10, 20) / 100
                time.sleep(t)
                continue
            else:
                continue
예제 #8
0
def jiejietupo():
    global runFlag, log, Btn_start, Btn_stop, count
    while runFlag:
        if util.click('jjtpjieshu'):
            stop(log, Btn_start, Btn_stop)
        elif util.click('shuaxinqueren'):
            pass
        elif util.click('jjtpjingong'):
            pass
        elif util.click('jjtp'):
            pass
        else:
            util.click('jjtpshuaxin')
        for i in ['jjtpjiesuan', 'jjtpjiesuan1', 'jjtpjiesuan2', 'jujue']:
            if util.click(i):
                time.sleep(random.randint(10, 20) / 100)
                continue
            else:
                continue
예제 #9
0
def tansuo():
    global count, PhysicalLimit
    while runFlag:
        # 设定目标,开始查找
        # 进入后
        want = util.imgs['tu']
        pts = util.action.locate(util.getScreen(), want, 0)
        if not len(pts) == 0:
            msg = '%s-处于地图中\n' % (util.getTimeFormat())
            logMsg(log, msg)
            want = util.imgs['left']
            pts = util.action.locate(util.getScreen(), want, 0)
            if not len(pts) == 0:
                right = (854, 527)
                right = util.action.cheat(right, 10, 10)
                pyautogui.click(right)
                time.sleep(random.randint(30, 60) / 100)
                continue
            want = util.imgs['jian']
            pts = util.action.locate(util.getScreen(), want, 0)
            if len(pts) >= 1:
                msg = '%s-点击小怪\n' % (util.getTimeFormat())
                logMsg(log, msg)
                xx = util.action.cheat(pts[0], 10, 10)
                pyautogui.click(xx)
            else:
                for i in ['queren', 'tuichu']:
                    if util.click(i):
                        msg = '%s-退出中\n' % (util.getTimeFormat())
                        logMsg(log, msg)
                        time.sleep(random.randint(15, 30) / 100)
                        break
            if util.checkMan():
                count = count + 3
                changeCost(cost, count)
            if (count >= PhysicalLimit) & (PhysicalLimit != 0):
                msg = '%s-已消耗体力-%d\n' % (util.getTimeFormat(), count)
                logMsg(log, msg)
                stop(log, Btn_start, Btn_stop)
        want = util.imgs['jjtpman']
        pts = util.action.locate(util.getScreen(), want, 0)
        if len(pts) >= 1:
            print('结界突破满')
            util.click('28guanbi')
            time.sleep(random.randint(50, 80) / 100)
            util.click('jjtpkaishi')
            while True:
                if util.click('jjtpjieshu'):
                    while not util.click('jjtpguanbi'):
                        pass
                    break
                elif util.click('shuaxinqueren'):
                    pass
                elif util.click('jjtpjingong'):
                    pass
                elif util.click('jjtp'):
                    pass
                else:
                    util.click('jjtpshuaxin')
                for i in [
                        'jjtpjiesuan', 'jjtpjiesuan1', 'jjtpjiesuan2',
                        'jjtpshibai', 'jujue'
                ]:
                    if util.click(i):
                        time.sleep(random.randint(10, 20) / 100)
                        continue
                    else:
                        continue
        for i in [
                '28', 'tansuo', 'ying', 'jiangli', 'jixu', 'jujue',
                'yuhunqueren'
        ]:
            if util.click(i):
                time.sleep(random.randint(10, 20) / 100)
                continue
            else:
                continue
예제 #10
0
def resort():
	hWnd = win32gui.FindWindow(None, "QQ游戏 - 连连看角色版")	
	win32gui.SetForegroundWindow(hWnd)
	win32gui.SetActiveWindow(hWnd)
	click(hWnd, "resort")