Tab navigation using Selenium – a stable way:

Brief:

Another blog about my experience, analysis and concluding browser ‘TAB’ navigation in automation.Hope this will help you to design an stable tab navigation framework:

Basics about tabs before jumping into code:

Browser window and tab are different! Each window have separate unique window handle where tabs are array of a same handle. Hence by switching between the handle we will achieve window navigation (comparatively simple!), not tab navigation. Just to elaborate with example: internally when we open new browser window, both the window will have separate handle like CDwindow-4f2d1560-16bf-40a3-81be-dd91e13d6390 (for browser window-1) and CDwindow-4fc2d1560-16bf-40a3-81be-dd91e13e6390 (for browser window-2), whereas two tabs are considered as array of same handle like CDwindow-4f2d1560-16bf-40a3-81be-dd91e13d6390[0] (for tab-1) and CDwindow-4f2d1560-16bf-40a3-81be-dd91e13d6390[1] (for tab-2).

Common tab operation:

  • Right click and open a link in new tabs.
  • Pointing the driver to different tabs.
  • Closing the tabs.

Continue reading “Tab navigation using Selenium – a stable way:”