testng-opening multiple browsers for scenario examples
I have this feature file
- Given User is on my website
- When User is Admin or Mastering Editor
3.And User is on /page/ page
4.And User click /header/ link
5.Then User should be taken to /target page/
Examples: Of page, header and target | page | header | target page | | Homepage | Master | Master page | | Homepage | Translation | Translation page |
For "Given User is on my website" I wrote the login details, and this is opening new browser for every example in scenario. I want single browser to open and do all examples. can anyone help please
Follow these steps:
- Create one driver class with initialization, closing and some common driver related methods
- Create your step definition file with extends this driver class.
- Create before class method to initialize the driver
- every step will be using the same opened browser
so every feature file one browser will be initialized.
public class PersonSteps extends DriverHelper