Ejemplo n.º 1
0
 def setUp(self):
     self.browser = Slot.browser()
     self.com = Common(self.browser)
     self.wg = WebGame(self.browser)
     self.pg = PlayGame(self.browser)
     self.wr = WebRecord(self.browser)
     self.csv = "../data/game_list.csv"
Ejemplo n.º 2
0
        logging.info("==========获取CSV-游戏名称数据==========")
        with open(csv_file, "r", encoding="utf-8-sig") as file:
            reader = csv.reader(file)
            for index, row in enumerate(reader, 1):
                if index == line:
                    logging.info("根据索引返回单个游戏名称")
                    return row

    # 关闭除大厅外全部标签页
    def close_all_tab(self):
        logging.info("==========关闭除大厅外全部标签页==========")
        try:
            while 1 < len(self.browser.window_handles):
                time.sleep(1)
                self.browser.switch_to.window(self.browser.window_handles[-1])
                self.browser.close()

            self.browser.switch_to.window(self.browser.window_handles[0])
        except Exception:
            logging.error("Close Tab Fail!")
            self.get_screen_shot("Close Tab Fail")
            raise


if __name__ == '__main__':
    browser = Slot.browser()
    com = Common(browser)
    csv_file = "../data/game_list.csv"
    data = com.get_csv_data("../data/game_list.csv", 80)
    print(data)