예제 #1
0
def addDiagnosis(url, driver):
    '''
    Main Logic behind addition of diagnosis for patient

    Arguments:
        url(str): Target URL
        driver(obj): firefox webdriver instance in python 
    
    Returns:
        None
    '''
    patientCredentials = getPatientCredentials()
    therapistCredentials = getTherapistCredentials()
    driver.get(url + "Therapist/My-Patients/View")
    driver.find_element_by_id('BodyContent_TextboxSearch').send_keys(
        patientCredentials[0])
    driver.find_element_by_id('BodyContent_ButtonSearch').click()
    time.sleep(10)
    driver.find_element_by_id(
        'BodyContent_GridViewPatient_LinkButtonViewDiagnosis_0').click()
    time.sleep(10)
    driver.find_element_by_id('BodyContent_TextboxSearchDiagnosis').send_keys(
        therapistCredentials[2])
    driver.find_element_by_id('BodyContent_ButtonSearchDiagnosis').click()
    time.sleep(10)
    addDiagnosisScript = "__doPostBack('ctl00$BodyContent$GridViewPatientDiagnosisAdd$ctl02$ctl00','')"
    driver.execute_script(addDiagnosisScript)
    time.sleep(10)
    logoutScript = "__doPostBack('ctl00$ctl13','')"
    driver.execute_script(logoutScript)
    driver.close()
    driver.quit()
    print(" -Therapist has created a new diagnosis")
예제 #2
0
def assignTherapist(url, driver):
    '''
    Main Logic behind assigning therapist for the patient

    Arguments:
        url(str): Target URL
        driver(obj): firefox webdriver instance in python 
    
    Returns:
        None
    '''
    patientCredentials = getPatientCredentials()
    therapistCredentials = getTherapistCredentials()
    driver.get(url + 'Admin/Manage-Accounts/View')
    driver.find_element_by_id('BodyContent_TextboxSearch').send_keys(
        patientCredentials[0])
    driver.find_element_by_id('BodyContent_ButtonSearch').click()
    time.sleep(10)
    patientScript = "__doPostBack('ctl00$BodyContent$GridViewAccounts$ctl02$ctl02','')"
    driver.execute_script(patientScript)
    time.sleep(10)
    driver.find_element_by_id('BodyContent_TextboxSearchTherapist').send_keys(
        therapistCredentials[0])
    driver.find_element_by_id('BodyContent_ButtonSearchTherapist').click()
    therapistScript = "__doPostBack('ctl00$BodyContent$GridViewTherapists$ctl02$ctl00','')"
    driver.execute_script(therapistScript)
    time.sleep(10)
    logoutScript = "__doPostBack('ctl00$ctl13','')"
    driver.execute_script(logoutScript)
    driver.close()
    driver.quit()
    print(" -Therapist assigned to patient")
예제 #3
0
def requestPermissions(url, driver):
    '''
    Main Logic behind requesting permission for therapist to access patient records

    Arguments:
        url(str): Target URL
        driver(obj): firefox webdriver instance in python 
    
    Returns:
        None
    '''
    try:
        patientCredentials = getPatientCredentials()
        therapistCredentials = getTherapistCredentials()
        information = str(patientCredentials[9]).lower()
        driver.get(url + 'Therapist/My-Patients/New-Request')
        driver.find_element_by_id('BodyContent_TextboxSearch').send_keys(
            patientCredentials[0])
        driver.find_element_by_id('BodyContent_ButtonSearch').click()
        time.sleep(10)
        driver.find_element_by_id(
            'BodyContent_GridViewPatient_LinkButtonRequest_0').click()
        if information == "height":
            driver.find_element_by_id('CheckBoxTypeHeightMeasurement').click()
        elif information == "weight":
            time.sleep(10)
            weightBox = driver.find_element_by_id(
                'CheckBoxTypeWeightMeasurement').click()
        elif information == "temperature":
            time.sleep(10)
            driver.find_element_by_id(
                'CheckBoxTypeTemperatureMeasurement').click()
        elif information == "bp":
            time.sleep(2)
            driver.find_element_by_id(
                'CheckBoxTypeBloodPressureMeasurement').click()
        else:
            print("No such permissions")
            return
        driver.find_element_by_id('BodyContent_buttonRequest').click()
        logoutScript = "__doPostBack('ctl00$ctl13','')"
        driver.execute_script(logoutScript)
        driver.close()
        driver.quit()
        print(" -Therapist request for permission")
    except:
        driver.close()
        driver.quit()
        print("Permission already obtained")
예제 #4
0
def main(url):
    '''
    Logic behind the main function

    Arguments:
        url(str) : Target URL

    Returns:
        None
    '''
    driver = None
    try:
        adminCredentials = getAdminCredentials()
        therapistCredentials = getTherapistCredentials()
        patientCredentials = getPatientCredentials()
        driver = getDriver(url)
        adminLogin(url, driver, adminCredentials[0], adminCredentials[1])
        registerPatientAccount(url, driver)
        assignTherapist(url, driver)
        driver = getDriver(url)
        patientLogin(url, driver, patientCredentials[0], patientCredentials[8])
        createNewRecord(url, driver)
        driver = getDriver(url)
        therapistLogin(url, driver, therapistCredentials[0],
                       therapistCredentials[1])
        requestPermissions(url, driver)
        driver = getDriver(url)
        patientLogin(url, driver, patientCredentials[0], patientCredentials[8])
        approvePermissions(url, driver)
        driver = getDriver(url)
        therapistLogin(url, driver, therapistCredentials[0],
                       therapistCredentials[1])
        addDiagnosis(url, driver)
        driver = getDriver(url)
        patientLogin(url, driver, patientCredentials[0], patientCredentials[8])
        viewDiagnosis(url, driver)
    except:
        if (getDriverStatus(driver) == "alive"):
            driver.quit()
            print("Invalid hostname. Please try again!")
        else:
            print("Invalid hostname. Please try again!")