How to handle browser tabs in Emulator/Simulator?

How to handle browser tabs in Emulator/Simulator?

Hi Emma,

You can handle browser tabs in Emulators or Simulators with the codes mentioned below.

driver.getAllWindowHandles().then(function(handles){
for(let i=1;i<handles.length;i++){
if(handles[i]){
console.log("value of I:"+i);
console.log("vALUE of length:"+handles.length)
driver.switchTo().window(handles[i]);
console.log('reached');
//With below mentioned line user will again switch it back to the primary tab
browser.switchTo().window(handles[0]);

}


}







});