Switch to new tab is not working

Hi,

I am trying to automate one scenario where it opens a new tab after clicking on one of the link. This was recorded and while running the test it fails at switch to Window 1 step. Even though new tab appears error says “There is no such window with index 1, there are 1 windows”. I have set the adaptive wait to Very patient for both the steps (i.e., Clicking on the link and switching to new tab). Could someone plz help on this.

Hi @gurupreeth.karnik ,

Window index is counted by order of window’s appearance and starts from 0. After switching, window index does NOT change, i.e. the first window still has index 0, the second window still has index 1 and so on.

Let me know if you managed.

Hi @alex.ivanov

thanks for the response. Do you mean to say we cannot switch to different tabs and perform some operations in newly opened tab. While recording I m able to switch to new tab and do some operation, will that not work while running the test. Let me know if you need more clarity on the above question

Hi @gurupreeth.karnik ,

Yes, more details and clarity about the question will be helpful.

Hi @alex.ivanov , below is the scenario I m trying

  1. Click on some link which present in the page, which will open a new tab
  2. New tab opens, and we are trying to call switch window action (i.e. Switch to window “1”). This is a recorded step.
  3. Test fails at this step citing “There is no such window with index 1, there are 1 windows”.

We tried introducing delay at both step 1 and 2, but did not help. I hope this is clear