Use 'From Template' instead of 'Duplicate' to create new prof pages
authorW. Trevor King <wking@drexel.edu>
Thu, 1 Jul 2010 02:38:40 +0000 (22:38 -0400)
committerW. Trevor King <wking@drexel.edu>
Thu, 1 Jul 2010 02:38:40 +0000 (22:38 -0400)
sitecore/prof/import.py

index 3b949a636bff7b115e3132c0a5794da87370789f..e48891097434c8af57aba9f72818183de0cffd87 100644 (file)
@@ -120,9 +120,14 @@ class ProfessorAdder (object):
             return
         except NoSuchElementException:
             pass
-        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()
+        #self.s.w.find_element_by_link_text('Duplicate').click()
+        # WebDriver doesn't support JavaScript prompts:
+        #   http://code.google.com/p/selenium/wiki/FrequentlyAskedQuestions#Q:_Does_support_Javascript_alerts_and_prompts?
+        self.s.open_nav_section('facultyDirectory')
+        self.s.w.find_element_by_link_text('Developer').click()
+        time.sleep(self.s.wait_time)
+        self.s.w.find_element_by_link_text('From Template').click()
         time.sleep(self.s.wait_time)
         windows = self.s.w.get_window_handles()
         current_window = self.s.w.get_current_window_handle()
@@ -131,13 +136,14 @@ class ProfessorAdder (object):
             self.s.logger.info('handling copy popup %s (from %s, old %s)'
                                % (popup, windows, current_window))
             self.s.w.switch_to_window(popup)
-        filename = self.s.w.find_element_by_id('Filename')
-        filename.clear()
-        filename.send_keys(
-            '/sitecore/content/Home/physics/contact/facultyDirectory/%s'
-            % name)
+        template = self.s.w.find_element_by_id('TemplateName')
+        template.clear()
+        template.send_keys('/Drexel/FacultyProfile')
+        faculty = self.s.w.find_element_by_id('ItemName')
+        faculty.clear()
+        faculty.send_keys(name)
         self.s.w.find_element_by_id('OK').click()
-        time.sleep(self.s.wait_time)
+        time.sleep(self.s.wait_time*5)
         current_window = self.s.w.get_current_window_handle()
         self.s.logger.info('handled copy popup %s, back to %s'
                            % (popup, current_window))