Exemple #1
0
class Task():
    def __init__(self, id):
        self.screen = Screen(id)
        self.android = self.screen.AndroidBase
        self.width = self.android.width

    def chat(self):
        self.screen.clickTalking()
        self.screen.sendChinese('求关注,必回关!求关注,必回关!求关注,必回关!')
        self.screen.clickTalkingSend()

    def checkNoFollow(self):
        rr = self.screen.findYiGuanZu()
        if rr:
            self.screen.click(200)
            rr = self.screen.findSiXing()
            if rr:
                self.screen.click()
                self.screen.clickTalking()
                self.screen.sendChinese('宝宝,我关注你了,你也要关注我一下哦')
                self.screen.clickSiXingSend()
                self.android.ClickReturn()

    def followHost(self):
        self.screen.followHost()

    def followFans(self):
        self.screen.clickFanNum()
        m = round(uniform(1.0, 4.0), 1)
        time.sleep(m)
        self.screen.followFan()
        self.screen.followFan()
        self.screen.followFan()
        self.screen.followFan()
        self.screen.followFan()
        self.android.ClickReturn()
        m = round(uniform(3.0, 10.0), 1)
        time.sleep(m)
        self.android.RollingUpLittle()

    def screenShot(self):
        self.android.PullScreenShot()

    def doubleClick(self):
        self.android.OneClick(200, 800)
        self.android.OneClick(200, 800)
Exemple #2
0
class Task():
    def __init__(self, id):
        self.screen = Screen(id)
        self.android = self.screen.AndroidBase
        self.width = self.android.width

    def clickFavorite(self, name):
        r = self.screen.findPng('./wechat/' + str(self.width) +
                                '/favoriteButton.png')
        if r:
            print('点击favorite')
            self.screen.click()
            r = self.screen.findPng('./wechat/' + str(self.width) + '/' + name)
            if r:
                print('点击' + name)
                self.screen.click()
                r = self.screen.findPng('./wechat/' + str(self.width) +
                                        '/favoriteSend.png')
                if r:
                    print('点击favorite发送')
                    self.screen.click()
                    time.sleep(3)
                    return True
                else:
                    print('未找到favorite发送')
            else:
                print('未找到' + name)
        else:
            print('未找到favorite')
        return False

    def thumb(self):
        time.sleep(5)
        r = self.screen.findRedPoint()
        if r == True:
            self.screen.click()

            time.sleep(3)

            r = self.screen.findVideoBlock()
            if r:
                self.screen.click()
                time.sleep(15)  # 看视频
                self.android.RollingUpLittle()

                r = self.screen.findPng('./wechat/' + str(self.width) +
                                        '/thumbIcon.png')
                if r:
                    print('点击thumb')
                    self.screen.click()
                    r = self.screen.findPng('./wechat/' + str(self.width) +
                                            '/commentIcon.png')
                    if r:
                        print('点击comment')
                        self.screen.click()
                        self.screen.thumbComment()
                        time.sleep(2)
                        r = self.screen.findPng('./wechat/' + str(self.width) +
                                                '/replyButton.png')
                        if r:
                            print('发送评论')
                            self.screen.click()
                            self.screen.return2()
                            r = self.screen.findPng('./wechat/' +
                                                    str(self.width) +
                                                    '/plusButton.png')
                            if r:
                                print('点击plus')
                                self.screen.click()
                                r = self.clickFavorite('longTxt.png')
                                if r:
                                    r = self.clickFavorite(
                                        'favoriteVideoText.png')
                                    if r:
                                        self.android.OneClick(
                                            2, self.screen.height / 4)
                                        time.sleep(3)
                                        r = self.screen.matchUserIcon()
                                        if r:
                                            print('长按头像')
                                            self.screen.clickLong()
                                            time.sleep(3)
                                            r = self.screen.findPng(
                                                './wechat/' + str(self.width) +
                                                '/sendButton.png')
                                            if r:
                                                print('发送回复')
                                                self.screen.click()
                                                time.sleep(3)
                                                self.screen.return2()
                                            else:
                                                print('未找到回复按钮')
                                                self.screen.return1()
                                        else:
                                            print('未找到用户头像')
                                            self.screen.return1()
                                    else:
                                        self.screen.return3()
                                else:
                                    self.screen.return3()
                            else:
                                print('未找到plus')
                                self.screen.return1()

                        else:
                            print('没找到replyButton,返回')
                            self.screen.return4()
                    else:
                        print('没找到comment,返回')
                        self.screen.return2()
                else:
                    print('没找到thumb,返回')
                    self.screen.return2()
            else:
                print('没找到视频号')
                self.screen.return1()
        else:
            print('没找到红点')