I am using:
I am writing automat
As a last ditch effort, I am currently searching for a javascript command that I can use with IJavaScriptExecutor to switch tabs - no luck so far.
I'm providing you a trick using JavaScript to switching between tabs. This is not a perfect solution but you can use as alternate solution. You should try as :-
//Firstly try to switch window as you're doing
Session.Driver.SwitchTo().Window(Session.Driver.WindowHandles.First());
//Now execute a script which would popup the alert box on current window
IJavaScriptExecutor jscript = Session.Driver as IJavaScriptExecutor;
jscript.ExecuteScript("alert('Switch tab')");
//Now you can see alert would focused on desired tab
//Now you can accept this alert and do further steps on this tab
IAlert alert = Session.Driver.SwitchTo().Alert();
alert.Accept();
Note:- If you're getting alert exception when trying to accept alert and unable to find alert, You should wait until JavaScript trigger and alert box open.