Closed meilisong1 closed 4 years ago
Hi @meilisong1 Each test method needs to be independent from other test methods, therefore each one will handle spinning up and spinning down web browsers on their own to maintain a clean state. If you need to share a browser window for multiple "tests", consider having those tests be separate methods that are called from the same test method. Example:
from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def do_something(self):
self.open("http://www.baidu.com/")
# Do something here
def do_something_2(self):
self.open("http://www.qq.com/")
# Do something here
def test_some_things(self):
self.do_something()
self.do_something_2()
Hi @meilisong1 Each test method needs to be independent from other test methods, therefore each one will handle spinning up and spinning down web browsers on their own to maintain a clean state. If you need to share a browser window for multiple "tests", consider having those tests be separate methods that are called from the same test method. Example:
from seleniumbase import BaseCase class MyTestClass(BaseCase): def do_something(self): self.open("http://www.baidu.com/") # Do something here def do_something_2(self): self.open("http://www.qq.com/") # Do something here def test_some_things(self): self.do_something() self.do_something_2()
thx
class TestCaseClass(WebBaseCase):
It's not uncommon to not want to write all validation into one testcase, but not to close the browser every time
in addition: Since we are using intelligent validation, --user-data-dir also tried and failed