tmp = self.vote(qa_id) # bo.update_cookie_to_db(self.d, self.conf.task_guid, self.conf.user, 'QA问答', 'vote 投票') return tmp else: # bo.update_cookie_to_db(self.d, self.conf.task_guid, self.conf.user, 'QA问答', 'vote 投票') return False def yes_no_opt(self): qa_id = self.search() if qa_id: tmp = self.answer_yes_no(qa_id) # bo.update_cookie_to_db(self.d, self.conf.task_guid, self.conf.user, 'QA问答', '问答点赞') return tmp else: # bo.update_cookie_to_db(self.d, self.conf.task_guid, self.conf.user, 'QA问答', '问答点赞') return False if __name__ == '__main__': conf = setting.ChromeConf() # 可传入浏览器参数类,修改设置参数 driver = bo.Initial_browser(conf).set_chrome() # 初始化浏览器 d = bo.Driver(driver) d.request('https://www.amazon.com/dp/B077Y8DN87') h = QA(d) qid = h.search() if qid: print '1' h.answer_yes_no(qid) else: print qid, 'qid'
def ini_browser_drive(bs_conf, opt_conf): driver = bo.Initial_browser(bs_conf).set_chrome() return Driver(driver, opt_conf)