def create_prof_page(self, prof):
self.s.open_nav_section('Copy of Shyamalendu Bose')
+ old_windows = self.s.w.get_window_handles()
self.s.w.find_element_by_link_text('Copy To').click()
time.sleep(self.s.wait_time)
windows = self.s.w.get_window_handles()
current_window = self.s.w.get_current_window_handle()
- self.s.logger.info('handling copy popup %s (from %s)'
- % (current_window, windows))
+ popup = [w for w in windows if w not in old_windows][0]
+ if current_window != popup:
+ self.s.logger.info('handling copy popup %s (from %s, old %s)'
+ % (popup, windows, current_window))
+ self.s.w.switch_to_window(popup)
name = self.s.w.find_element_by_id('Filename')
name.clear()
name.send_keys(
% (prof.name.first, prof.name.last))
self.s.w.find_element_by_link_text('Copy').click()
time.sleep(self.s.wait_time)
+ current_window = self.s.w.get_current_window_handle()
+ self.s.logger.info('handled copy popup %s, back to %s'
+ % (popup, current_window))
def main(argv):