Picture: there is Popup window in the html
try:
all_handles = self.driver.window_handles
for handle in all_handles:
if handle != now_handle:
print handle
try:
self.driver.switch_to_window(handle)
self.driver.find_element_by_xpath(".//*[@id='ks-overlay-close-ks-component9045']").click()
except:
continue
but it is failed, i can not switch to the window and close it