Skip to content

How to call methods of different types in two files? #2448

Answered by mdmintz
luckyboy-wei asked this question in Q&A
Discussion options

You must be logged in to vote

The example from SeleniumBase/examples/boilerplates/classic_obj_test.py covers your scenario:

"""Classic Page Object Model with BaseCase inheritance."""
from seleniumbase import BaseCase
BaseCase.main(__name__, __file__)

class DataPage:
    def go_to_data_url(self, sb):
        sb.open("data:text/html,<p>Hello!</p><input />")

    def add_input_text(self, sb, text):
        sb.type("input", text)

class ObjTests(BaseCase):
    def test_data_url_page(self):
        DataPage().go_to_data_url(self)
        self.assert_text("Hello!", "p")
        DataPage().add_input_text(self, "Goodbye!")

After you modify your files to correctly use that format, they will look like this:

# aa.py

class EapCase

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@luckyboy-wei
Comment options

Answer selected by mdmintz
Comment options

You must be logged in to vote
1 reply
@mdmintz
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants