-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
seldom结合其他测试库比如playwright使用时,如何截图生成到测试报告中 #202
Comments
我自己试了一下是可以的,方法如下: import seldom
import base64
from playwright.sync_api import sync_playwright
from playwright.sync_api import expect
class Playwright(seldom.TestCase):
def start(self):
p = sync_playwright().start()
self.browser = p.chromium.launch()
self.page = self.browser.new_page()
def end(self):
self.browser.close()
def test_start(self):
page = self.page
page.goto("http://playwright.dev")
expect(page).to_have_title("Fast and reliable end-to-end testing for modern web apps | Playwright")
get_started = page.locator('text=Get Started')
expect(get_started).to_have_attribute('href', '/docs/intro')
get_started.click()
expect(page).to_have_url('http://playwright.dev/docs/intro')
# playwright 实现截图
screenshot_bytes = page.screenshot()
self.images.append(base64.b64encode(screenshot_bytes).decode()) 因为没有做封装,有点麻烦而已。 |
defnngj
added a commit
that referenced
this issue
Nov 16, 2023
# playwright 实现截图
screenshot_bytes = page.screenshot()
self.screenshots(image=screenshot_bytes) |
好的,多谢! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: