Allow a few tries for 'Home' to open in prof/import.py
authorW. Trevor King <wking@drexel.edu>
Tue, 29 Jun 2010 12:46:21 +0000 (08:46 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 29 Jun 2010 12:46:21 +0000 (08:46 -0400)
sitecore/prof/import.py

index bc5440bb88d7ac2f2e9669a110ddabbbbfa81206..46f74d3f0b5afc8e3bda6ee2e17bbb631431ef26 100644 (file)
@@ -22,6 +22,8 @@ Professors will be created in:
   Content -> Drexel -> ? -> physics -> ?
 """
 
+import time
+
 from selenium.common.exceptions import NoSuchElementException
 import yaml
 
@@ -39,7 +41,11 @@ class ProfessorAdder (object):
         #self.s.expand_nav_section('sitecore')
         #self.s.expand_nav_section('Content')
         self.s.expand_nav_section('Home')
-        self.s.expand_nav_section('physics')
+        for i in range(5): # 'physics' takes a while to load
+            try:
+                self.s.expand_nav_section('physics')
+            except NoSuchElementException, e:
+                time.sleep(self.s.wait_time)
         self.s.expand_nav_section('contact')
         self.s.expand_nav_section('facultyDirectory')