From: W. Trevor King Date: Mon, 28 Jun 2010 13:29:23 +0000 (-0400) Subject: First attempt at professor copying code X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=57d6747b8b54c8f71ce22ba9fe556f37810641e0;p=sitecorepy.git First attempt at professor copying code --- diff --git a/sitecore/prof/import.py b/sitecore/prof/import.py index 08dc4b9..bc5440b 100644 --- a/sitecore/prof/import.py +++ b/sitecore/prof/import.py @@ -36,16 +36,35 @@ class ProfessorAdder (object): self.s = sitecore_connection def setup(self): - s.expand_nav_section('Media Library') - s.expand_nav_section('Images') - s.expand_nav_section('physics') - s.expand_nav_section('headshots') + #self.s.expand_nav_section('sitecore') + #self.s.expand_nav_section('Content') + self.s.expand_nav_section('Home') + self.s.expand_nav_section('physics') + self.s.expand_nav_section('contact') + self.s.expand_nav_section('facultyDirectory') def __call__(self, prof): - raw_name = TODO - s.open_nav_section(raw_name) + self.create_prof_page(prof) + self.s.open_nav_section(raw_name) TODO + def create_prof_page(self, prof): + self.s.open_nav_section('Copy of Shyamalendu Bose') + self.s.w.find_element_by_link_text('Copy To').click() + time.sleep(self.s.wait_time) + windows = self.w.get_window_handles() + current_window = self.w.get_current_window_handle() + self.logger.info('handling copy popup %s (from %s)' + % (current_window, windows)) + name = self.s.find_element_by_id('Filename') + name.clear() + name.send_keys( + '/sitecore/content/Home/physics/contact/facultyDirectory/%s %s' + % (prof.name.first, prof.name.last)) + self.s.w.find_element_by_link_text('Copy').click() + time.sleep(self.s.wait_time) + + def main(argv): import optparse usage = """%prog [options] PROF_FILE @@ -77,6 +96,6 @@ Example setup before running: a = ProfessorAdder(s) a.setup() for prof in profs: - a.aadd_profs(s, profs) + a.add_profs(s, profs) finally: s.stop()