| 26 | self.page = None |
| 27 | |
| 28 | async def send_key(self): |
| 29 | await asyncio.sleep(random.randint(2, 3)) |
| 30 | switch_btn = await self.page.xpath('//ul/li[@class="text-tab border-right"][2]/a') |
| 31 | await switch_btn[0].click() |
| 32 | input_account = await self.page.xpath('//div[@class="form-group"]/div/input[1]') |
| 33 | await input_account[0].type(self.account, |
| 34 | {'delay': random.randint(100, 200) - 50}) |
| 35 | await self.page.type('#password-number', self.password, |
| 36 | {'delay': random.randint(100, 200) - 50}) |
| 37 | |
| 38 | await self.page.click('button[data-type=account]') |
| 39 | await asyncio.sleep(random.randint(5, 10)) |
| 40 | |
| 41 | async def crawl(self): |
| 42 | # 测试环境下 headless 设置为 False |