Search code examples
javaswingselenium

Selenium control multiple browsers at the same time


I'm still learning to use Selenium and come up with this question, supposed that I want to open 2 same browsers (2x firfox) at the same time, for the first browser I want it to navigate to google.com and search for the first keyword then click on the first link. In the mean time, the second browser will navigative to google.com and search for the second keyword then click on the first link. Those actions are happening at the same time so they will (or may) close at the same time to save time.

Can you please point me to the right direction what do i need to read or look into in order to archive this task? I read another post on Swing Worker but that's another multi-threading thing. My naive approach is to create a new driver then start them at the same time, but is it any other ways?

Thank you.


Solution

  • With the help of maven and TestNG this can be accomplished. Check this answer and git maven template