I'm here to ask a question. I'm trying to close a pop-up window. This is my code
from selenium import webdriver
driver.switch_to(driver.window_handles\[1\])
driver.close()
driver.switch_to(driver.window_handles\[0\])
But i could get only this.
TypeError: 'SwitchTo' object is not callable
How can i please help me and Thx for reading this.
You are trying to call the
switch_to()method on the driver object directly. You should first get the driver object fromwebdriver.Chrome().Below is the solution.