Skip to content

If the window closes too quickly, switch_to_window is invalid #1435

Answered by mdmintz
chenqinggang001 asked this question in Q&A
Discussion options

You must be logged in to vote

You might be able to close the active window/tab directly, and then switch to the most recent one after that:

self.driver.close()
self.switch_to_window(-1)

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@chenqinggang001
Comment options

@mdmintz
Comment options

@chenqinggang001
Comment options

Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants