79230564

Date: 2024-11-27 13:53:57
Score: 1
Natty:
Report link

The issue lies in your @BeforeSuite setup. Since you're initializing the WebDriver at the suite level, the same driver instance is shared across all tests, causing conflicts in parallel execution.

To fix this, move the WebDriver initialization to @BeforeClass (or @BeforeMethod if you need a new browser instance per test). Here's the updated code:

public class BaseTest {

protected WebDriver driver;

@BeforeClass
public void setup() {
    WebDriverManager.chromedriver().setup();
    driver = new ChromeDriver();
    driver.manage().window().maximize();
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}

@AfterClass
public void tearDown() {
    if (driver != null) {
        driver.quit();
    }
}

}

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @BeforeSuite
  • User mentioned (0): @BeforeClass
  • User mentioned (0): @BeforeMethod
  • Low reputation (1):
Posted by: GabrielFethi