If you would like to share the same WebDriver across two or more @Test annotated methods in the same test class, then annotate your openBrowser() method with an @BeforeClass annotation.
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/b0ed0868-c203-41e4-9d16-cc07f65b1a26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
**Query# What is the best solution to share same WebDriver object through out our tests? Meaning if we are running a test suite where each test performs a different operation, how do we maintain the same browser session through out?**## Meta -OS:<MAC OS, Windows>Selenium Version:<WebDriver 3.4 -->Browser:Firefox,ChromeBrowser Version:<Chrome 60.0 (64-bit) -->Sample Code goes like this -public class BaseClass {static WebDriver driver;
@BeforeClass
public void openBrowser() throws Exception{driver=SelectBrowser.StartBrowser("firefox","http://automationpractice.com/");Login objLogin=PageFactory.initElements(driver, Login.class);driver=objLogin.TestLogin();}
@AfterClass
Can you please share the complete code ? Am guessing that your webdriver instantiation is happening somewhere else
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/bf54e3bf-a8d1-4fd1-8ee6-67429c0089bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.