generate_bill_page.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. '''
  4. @File : generate_bill_page.py
  5. @Time : 2025/01/04 08:52:10
  6. @Author : dulip3ng
  7. @Version : 1.0
  8. @Desc : None
  9. '''
  10. from playwright.sync_api import Page
  11. from pages.base_page import BasePage
  12. from pages.body_page import BodyPage
  13. from pages.head_page import HeadPage
  14. class GenerateBillPage(BasePage):
  15. """
  16. 生成单据页面对象(单据分单下推时弹出)
  17. """
  18. def __init__(self, page: Page, locator, head_page:HeadPage, body_page:BodyPage):
  19. super().__init__(page)
  20. self.locator = locator
  21. self.head_page = head_page
  22. self.body_page = body_page
  23. def click_button(self, button_name:str):
  24. """
  25. 点击菜单按钮,如”生成单据“
  26. :param button_name: 按钮名称
  27. :return:
  28. """
  29. self.page.locator(self.locator.BUTTON_ARGS_LOC % button_name).click()
  30. def click_line(self, row_no:int):
  31. """
  32. 点击行,以便切换生成的单据信息
  33. :param row_no: 行号,从1开始
  34. :return:
  35. """
  36. self.page.locator(self.locator.LINE_NO_ARGS_LOC % (row_no-1)).click()