In [1]:
from pathlib import Path
from seleniumrequests import Firefox

import PageObjects.implementations as scripts
import PageObjects.pages as page
import PageObjects.locators as loc

In [2]:
scrpt = scripts.IndicatorAreaEnrollment()
scrpt.enroll_all_students()


---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-2-1c139c12842e> in <module>()
      1 scrpt = scripts.IndicatorAreaEnrollment()
----> 2 scrpt.enroll_all_students()

C:\Users\perus\GitHub\cy-automation-library\cyautomation\cyschoolhouse\PageObjects\implementations.py in enroll_all_students(self)
    149     def enroll_all_students(self):
    150         """Executes the full IA enrollment"""
--> 151         self.nav_to_form()
    152         self.error_count = 0
    153         for student_id in self.student_list:

C:\Users\perus\GitHub\cy-automation-library\cyautomation\cyschoolhouse\PageObjects\implementations.py in nav_to_form(self)
    106         ensuring the page is loaded appropriately
    107         """
--> 108         self.launch_cyschoolhouse()
    109         cysh_home = page.CyshHomePage(self.driver)
    110         assert cysh_home.page_is_loaded()

C:\Users\perus\GitHub\cy-automation-library\cyautomation\cyschoolhouse\PageObjects\implementations.py in launch_cyschoolhouse(self)
     73         """Script for logging into Okta and cyschoolhouse"""
     74         # Login via okta
---> 75         self.login()
     76         # Nav from Okta home to cyschoolhouse
     77         Okta = page.OktaHomePage(self.driver)

C:\Users\perus\GitHub\cy-automation-library\cyautomation\cyschoolhouse\PageObjects\implementations.py in login(self)
     68         self.set_up()
     69         self.enter_credentials(self.user, self.pwd)
---> 70         self.check_logged_in()
     71 
     72     def launch_cyschoolhouse(self):

C:\Users\perus\GitHub\cy-automation-library\cyautomation\cyschoolhouse\PageObjects\implementations.py in check_logged_in(self)
     62         """Confirm login"""
     63         homepage = page.OktaHomePage(self.driver)
---> 64         assert homepage.page_is_loaded()
     65 
     66     def login(self):

C:\Users\perus\GitHub\cy-automation-library\cyautomation\cyschoolhouse\PageObjects\pages.py in page_is_loaded(self)
     19 
     20     def page_is_loaded(self):
---> 21         self.wait_for_page_to_load()
     22         return self.title in self.driver.title
     23 

C:\Users\perus\GitHub\cy-automation-library\cyautomation\cyschoolhouse\PageObjects\pages.py in wait_for_page_to_load(self)
     16 
     17     def wait_for_page_to_load(self):
---> 18         WebDriverWait(self.driver, 100).until(EC.title_contains(self.title))
     19 
     20     def page_is_loaded(self):

C:\Users\perus\AppData\Local\Continuum\Anaconda3\envs\selenium\lib\site-packages\selenium\webdriver\support\wait.py in until(self, method, message)
     75                 screen = getattr(exc, 'screen', None)
     76                 stacktrace = getattr(exc, 'stacktrace', None)
---> 77             time.sleep(self._poll)
     78             if time.time() > end_time:
     79                 break

KeyboardInterrupt: 

In [3]:
driver = Firefox()

In [4]:
scrpt = scripts.IndicatorAreaEnrollment(driver)

In [8]:
scrpt.driver.switch_to_window(scrpt.driver.window_handles[1])

In [81]:
student_id = 'a1U1a000002Ya7V'
ia_form = page.CyshIndicatorAreas(scrpt.driver)
ia_form.name_search = 'CASTILLO-NATERAS'
#ia_form.wait_for_page_to_load()
student = select_student(scrpt, student_id)

In [66]:
def select_student(self, student_id):
    """Selects a visible student using their Salesforce Id"""
    #WebDriverWait(self.driver, 10).until(EC.presence_of_all_elements_located((By.XPATH, "//table[@id='StudentsTable']")))
    table = self.driver.find_element_by_xpath("//table[@id='StudentsTable']/tbody")
    student = table.find_element_by_xpath("//tr[starts-with(@id, '" + student_id + "')]")
    student.click()
    #self.driver.find_element(*loc.IndicatorAreaLocators.ADD_BUTTON).click()
    return student

In [79]:
def select_student(self, student_id):
    table = self.driver.find_element_by_css_selector("Table[id*='StudentsTable'] tbody")
    student = table.find_element_by_css_selector("tr[id ^= '" + student_id + "'] td")
    student.click()
    #self.driver.find_element(*loc.IndicatorAreaLocators.ADD_BUTTON).click()
    return student

In [71]:
student.find_element_by_css_selector('.sorting_1').click()

In [78]:
student.click()

In [ ]: