My test case :
- Open a browser and visit a URL
- Click on a link on the homepage -> This opens a new window/new tab.
- Go back to the homepage.
- Click another link.
- Ensure new content shows up on previously opened child window/child tab from step 2.
I can check the number of windows open by getting a count of the windowhandles, and assert that it is equal to 2 - to ensure that on clicking the second link, the content refreshes on the same child window and doesn't open another new window.
If in case the links open in new tabs, how can I check this test case ( New tab opened the first time a link is clicked on the homepage. And on further clicking any links on the homepage, content is refreshed on the same new tab)? Is there a way to count the number of tabs in a window?
Or does selenium force new tabs to be opened as new windows instead?