C# Selenium No new Window Handles When Opening A New Tab In Chrome and Firefox -


selenium chrome , firefox, coding in c#, not handle switching on new tab opening during automation test. don't think focuses on new tab open because when run program completely, receive error: "out of range" exception , "index out of range. must non-negative , less size of collection."

i've tried using:

driver.switchto().window(driver.windowhandles.last()); 

and

driver.switchto().window(driver.windowhandles[1]); driver.switchto().window(driver.windowhandles[0]).close(); // close first tab system.threading.thread.sleep(5000); //wait 5 seconds in case driver.switchto().window(driver.windowhandles[1]); //makes sure i'm on correct tab 

but there no luck. if don't close first tab, receive error: "nosuchelementexception:unable locate element:{method...}" assume correct because focus still on first tab. appreciated. thank you.

once you've closed tab[0], old tab[1] becomes new tab[0], should switching tab[0].

selenium operates in background window not need in focus while running. means selenium never change focus browser window. if watching window while code runs should able see browser changing tabs.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -