|
@@ -1,5 +1,4 @@
|
|
|
from hytest import *
|
|
|
-from playwright.sync_api import sync_playwright
|
|
|
from PIL import Image, ImageChops
|
|
|
from bs4 import BeautifulSoup
|
|
|
import requests
|
|
@@ -52,16 +51,6 @@ class APILink():
|
|
|
element_value = element.text
|
|
|
return element_value
|
|
|
|
|
|
- def setup(self):
|
|
|
- # 初始化 Playwright
|
|
|
- self.playwright = sync_playwright().start()
|
|
|
- self.browser = self.playwright.chromium.launch(headless=True)
|
|
|
- self.page = self.browser.new_page()
|
|
|
-
|
|
|
- def teardown(self):
|
|
|
- # 关闭浏览器
|
|
|
- self.browser.close()
|
|
|
- self.playwright.stop()
|
|
|
|
|
|
def obtain_element_text(self,url,element):
|
|
|
self.page.goto(url)
|