# Opens a new tab self.driver.execute_script("window.open()") # Switch to the newly opened tab self.driver.switch_to.window(self.driver.window_handles[1])