I have situation when click on button opens new browser window. I try switch to it new window this way :
driver.SwitchTo().Window(driver.WindowHandles.Last());
But It does not work. There is error
'System.Collections.ObjectModel.ReadOnlyCollection' does not contain a definition for 'Last' and no extension method 'Last' accepting a first argument of type 'System.Collections.ObjectModel.ReadOnlyCollection' could be found (are you missing a using directive or an assembly reference?)
What should I do?
尝试在下面使用:
driver.SwitchTo().Window(driver.WindowHandles.ToList().Last());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.