1.设计思路

selenium基础练习1_selenium

2.代码结构

selenium基础练习1_代码结构_02

3.初始代码展示
from testpo.page1.contact_page import ContactPage


class MainPage:
    def goto_contact_page(self):
        return ContactPage()
class ContactPage:
    def click_add_member(self):
        from testpo.page1.add_member_page import AddMemberPage
        return AddMemberPage()
    def get_number(self):
        pass
class AddMemberPage:

    def add_member(self):
        from testpo.page1.contact_page import ContactPage

        return ContactPage()
from testpo.page1.main_page import MainPage


class TestLogin:
    def setup(self):
        self.main = MainPage()
    def teardown(self):
        pass
    def test_login(self):
        self.main.goto_contact_page().click_add_member().add_member().get_number()