1. The Facebook login page opens in a new window. In order for our selenium code to work on the new window, we have to switch to the window in front.
In Selenium, each window has a identification handle, we can get all the window handles with:
driver.window_handles
The above line of code returns a list of all the window handles. The first window is at position 0 e.g.
base_window = driver.window_handles[0]
New windows that have popped out from the base_window are further down in the sequence e.g.
fb_login_window = driver.window_handles[1]
We can switch our Selenium to target the new facebook login window by:
driver.switch_to.window(fb_login_window)
You can print the driver.title to verify that it's the facebook login window that is currently target:
print(driver.title)
The full code to switch to the new pop-up window is thus:
base_window = driver.window_handles[0] fb_login_window = driver.window_handles[1] driver.switch_to.window(fb_login_window) print(driver.title)
If successful the printed title should be "Facebook" and not "Tinder | Match. Chat. Date."
2. Using what you have learnt about Selenium, fill in the Facebook login form and submit it to log in.

NOTE: Avoid invoking the Facebook Login too frequently, see if you can test your code without logging in, you don't want to appear like a bot to Facebook as there is always the chance that they might disable your FB account. Alternatively, you can try setting up an alternative Facebook account.
If successful, you should see the pop-up window disappear and you're back on the Tinder page. e.g.

3. At this point, you should revert back to the base_window and verify by printing the title of the Selenium controlled window title.
driver.switch_to.window(base_window) print(driver.title)
If successful, it should print "Tinder | Match. Chat. Date."