I need to open a separate window from a link in my main page and leave the main opened. I am using the following code to do so:
self.find_element_by_locator(locator="css==a[href='#/vehicles']").send_keys(Keys.CONTROL + Keys.RETURN)
Then I need to do some stuff in the new window, so I try to switch the focus to it:
windows = self.driver.window_handles driver.switch_to.window(windows)
Problem: - The window opens correctly but the focus remains on the main window. (in this case the Error is that the index is out of range) When I make a Breakpoint and look into the
windows I see there is only one element in the list, which refers to the main page and the new page doesn't appear. I also tried opening a new Tab (sending keys Control 't' and then sending keys CONTROL TAB) but the problem remains (The window handles only sees one page or tab)
There is a similar Question but even the implicit_wait doesn't help.
I saw many people having the same problem, but still can't find an answer. Do I have to create a completely other WebDriver or is there easier ways to resolve this problem?
I'm working on Windows10 64Bit / Selenium 3.4.3 / Python 3 and IE11 (IEDriverServer_x64_3.4.0)