(self, cookies)
| 287 | return cookies |
| 288 | |
| 289 | def set_cookies(self, cookies): |
| 290 | try: |
| 291 | # 解决Chrome 90版本无法运行的问题[https://github.com/TechXueXi/TechXueXi/issues/78] |
| 292 | for cookie in cookies: |
| 293 | cookie_domain = cookie["domain"] |
| 294 | # fix cookie domain `.pc.xuexi.cn` caused refresh fail |
| 295 | if cookie_domain.endswith("pc.xuexi.cn"): |
| 296 | self.driver.get("https://pc.xuexi.cn/") |
| 297 | elif cookie_domain.endswith(".xuexi.cn"): |
| 298 | self.driver.get("https://www.xuexi.cn/") |
| 299 | else: |
| 300 | print(f"unknown cookie domain {cookie_domain}, skip it") |
| 301 | continue |
| 302 | |
| 303 | # print(f'current cookie: {cookie}') |
| 304 | # for expiry error (maybe old version compatibility) add by Sean 20210706 |
| 305 | if 'expiry' in cookie: |
| 306 | cookie['expiry'] = int(cookie['expiry']) |
| 307 | self.driver.add_cookie(cookie) |
| 308 | except exceptions.InvalidCookieDomainException as e: |
| 309 | print(e.__str__) |
| 310 | |
| 311 | def title_is(self, title): |
| 312 | return self.driver.title == title |
no outgoing calls
no test coverage detected