

I am using browser.execute_script('''window.open(" ","_blank") ''') Hi This is regarding selenium automation I am trying to switch between tabs using window handler could you tell me what am I doing wrong. # Put focus on current window which will be the window opener browser.

# do whatever you have to do on this page, we will just got to sleep for now sleep( 2) # Put focus on current window which will, in fact, put focus on the current visible tab browser. # Switch tab to the new tab, which we will assume is the next one on the right browser.

current_window_handle # Open the link in a new tab by sending key strokes on the element # Use: Keys.CONTROL + Keys.SHIFT + Keys.RETURN to open tab on top of the stack first_link. # Save the window opener (current window, do not mistaken with tab. find_element_by_class_name( 'rc'))įirst_link = first_result. Do whatever I have to do on this new pageįirst_result = ui.Wait for an element on the new page to be rendered (ui.WebDriverWait).Open a new window/tab by simulating a click on a link.So, after many minutes (read about an hour) of searching, I decided to do find a quick solution to this problem.įirst thing, I've broken down all the steps that were required to do by my program: Here's a couple people who ran into the same complication: There's no easy way to open a new tab, grab whatever you need and return to original window opener. On a recent project, I ran into an issue with Python Selenium webdriver.
