I am currently designing automation script for my project using Page object model with pagefactory. I am using Testing version 7.4.0 which is running individual test case. However, when I try running the suit, it runs the first test and knocks off the rest with the exception below.
Are you initializing any variable in @beforeclass/@beforemethod annotations, if so Can you try beforemethod and aftermethod annotations instead of beforetest and aftertest. Make sure page factory InitElement correctly placed in page classes - PageFactory.initElements(driver, this )
If you’re webdriver reference value is local you will get nullPointerException once it completed one test case , And that reference value will work onetime only . and you’re test cases are dependent or independent , if you’re test casese are independent you will launch the browser in @BeforeMethod will work, if your test casses are common to all the test casses (like login , or selecting the items then proceed to another tasks ) dependent in this scenario you will launch the browser in @BeforeClass