Beispiel #1
0
    def againuserLogin(self):

        print "Reading data from excel sheet"
        book = xlrd.open_workbook(os.path.join('TestData.xlsx'))

        # print number of sheets
        print("Number of WorkSheets :")
        print book.nsheets

        # print sheet names
        #print("Name of WorkSheets :")
        #print book.sheet_names()

        # get the first worksheet
        first_sheet = book.sheet_by_name('Login_Credentials')

        # read a row
        #print("First Row Data in 1st WorkSheet :")
        #print first_sheet.row_values(0)

        print("Fetching the URL, username and password from Excel Sheet\n")
        # read a cell
        cell = first_sheet.cell(1, 1)
        url = cell.value
        print url

        cell = first_sheet.cell(3, 1)
        username = cell.value
        print username

        cell = first_sheet.cell(3, 2)
        password = cell.value
        print password

        driver.get(url)
        element = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.ID, "password")))
        if driver.title == "Grovo":
            print("Grovo Application URL Opened")
        else:
            raise Exception.message

        print "Grovo Sign-In page is displayed"

        print "Entering User name"
        driver.find_element_by_xpath(".//*[@id='username']").send_keys(
            username)

        print "Entering Password"
        element.send_keys(password)

        element.send_keys(Keys.TAB)
        print "Clicking on Sign_In button"
        driver.find_element_by_xpath("//*[@id='submitButton']").click()

        print "Successfully Loged Into Grovo Application"
        time.sleep(5)
    def deleteLesson(self):

        print "\n\nDeleting all lessons.........."
        wait = WebDriverWait(driver, 80)
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH, "//a[@href='/create/lessons']")))

        print "Clicking on Lessons button from side menu"
        driver.find_element_by_xpath("//a[@href='/create/lessons']").click()
Beispiel #3
0
    def publishLesson(self, lesson_title):

        wait = WebDriverWait(driver, 60)
        #wait.until(EC.visibility_of_element_located((By.XPATH,"//span[@class='lesson-editor-status' and .='Saving...']")))
        #wait.until(EC.visibility_of_element_located((By.XPATH,"//span[@class='lesson-editor-status' and .='Saved']")))

        wait.until(
            EC.element_to_be_clickable((
                By.XPATH,
                ".//*[@id='content']/div/div/div[3]/div[3]/div[1]/div[3]/div[3]/button"
            )))
        driver.find_element_by_xpath(
            ".//*[@id='content']/div/div/div[3]/div[3]/div[1]/div[3]/div[3]/button"
        ).click()
        print "Clicking on READY TO PUBLISH button"

        #wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div/div[3]/div[3]/div[1]/div[3]/div[3]/div/div[1]/section[3]/div/button[1]")))
        driver.find_element_by_xpath(
            ".//*[@id='content']/div/div/div[3]/div[3]/div[1]/div[3]/div[3]/div/div[1]/section[3]/div/button[1]"
        ).click()
        print "Clicking on PUBLISH button"

        #print "Validating the success message after publish"
        #wait=WebDriverWait(driver, 60)
        #wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div/div[2]/div/div/span[2]")))
        #actual_success_message= driver.find_element_by_xpath(".//*[@id='content']/div/div/div[2]/div/div/span[2]").text
        #expected_success_message= "You have successfully published \"" + lesson_title + "\"";

        #if(expected_success_message==actual_success_message):

        # print "The success message is displaying as"+ " "+expected_success_message

        #else:

        #print "The success message is not displaying as expected"

        driver.find_element_by_xpath(
            ".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[1]/a"
        ).click()
        print "Clicking on EXIT button"

        print "Verifying lesson displayed in Grid"
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "(//tbody/tr/td[2]/a[.='" + lesson_title + "'])[1]")))

        if driver.find_element_by_xpath("(//tbody/tr/td[2]/a[.='" +
                                        lesson_title +
                                        "'])[1]").is_displayed():

            print "Lesson is displayed in Grid ::" + lesson_title

        else:
            print "Lesson not displaying in grid"

        driver.find_element_by_xpath(
            ".//*[@id='content']/div/div[3]/div[1]/div/nav/div/div[4]").click(
            )
    def mainDelete_attribute(self):
        try:
            d = Delete_Tags_Attributes_Lessons()
            wait = WebDriverWait(driver, 60)
            wait.until(
                EC.visibility_of_element_located((
                    By.XPATH,
                    "html/body/div/div/div[3]/div[1]/div/nav/div/div[2]/div[6]/a"
                )))
            driver.find_element_by_xpath(
                "html/body/div/div/div[3]/div[1]/div/nav/div/div[2]/div[6]/a"
            ).click()
            print "Clicked on admin icon"
            wait.until(
                EC.visibility_of_element_located((
                    By.XPATH,
                    "html/body/div/div/div[3]/div[1]/div/nav/div/div[2]/div[6]"
                )))
            driver.find_element_by_xpath(
                "html/body/div/div/div[3]/div[1]/div/nav/div/div[2]/div[6]"
            ).click()
            print "Clicked on Admin"
            driver.find_element_by_xpath(
                "html/body/div/div/div[3]/div[1]/div/nav/div/div[2]/div[6]/div/ul/li[1]"
            ).click()
            print "Clicked on User Attribute"
            driver.find_element_by_xpath(
                "html/body/div/div/div[3]/div[1]/div/nav/div/div[2]/div[6]/div/ul/li[4]"
            ).click()
            print "User attribute Page Loaded"

            count = driver.find_element_by_xpath(
                "//*[@id='content']/div/div[3]/div[2]/div/div/ul/li[1]/span"
            ).text
            print count

            if count == '0':
                print "No Attributes to delete"
            else:
                wait.until(
                    EC.visibility_of_element_located((
                        By.XPATH,
                        "html/body/div/div/div[3]/div[2]/div/div/div/div[2]/div/table/tbody/tr[1]/td[5]/button"
                    )))
                print "Deleting all attributes"
                ele = driver.find_elements_by_xpath("//tbody/tr/td[5]/button")
                count = len(ele)

                for count in range(0, count):
                    d.deleteAttribute()
                print "All Attributes are deleted"

        finally:
            book = xlrd.open_workbook(os.path.join('TestData.xlsx'))
            second_sheet = book.sheet_by_name('Login_Credentials')
            cell = second_sheet.cell(1, 1)
            url = cell.value
            driver.get(url)
    def userDeactivation(self):
        i = 0
        for i in range(4):

            print "Reading data from excel sheet"
            book = xlrd.open_workbook(os.path.join('TestData.xlsx'))
            sheet1 = book.sheet_by_name('CreateuserfromUI')
            print("Fetching the LastName from Excel Sheet\n")
            #Read from Excel to search
            cell1 = sheet1.cell(i + 1, 1)
            searchfirstName = cell1.value
            print searchfirstName
            cell2 = sheet1.cell(i + 1, 2)
            searchlastName = cell2.value
            print searchlastName
            SearchName = searchfirstName + " " + searchlastName
            print SearchName
            #Clicking on Admin Menu from Grovo Application

            driver.find_element_by_xpath(
                ".//*[@id='content']/div/div[3]/div[1]/div/nav/div/div[2]/div[6]/a"
            ).click()
            wait = WebDriverWait(driver, 80)
            wait.until(
                EC.visibility_of_element_located((By.ID, "search-users")))
            driver.find_element_by_id("search-users").send_keys(SearchName)
            wait = WebDriverWait(driver, 80)
            #To click on FirstName link
            wait.until(
                EC.visibility_of_element_located((
                    By.XPATH,
                    "html/body/div/div/div[3]/div[2]/div/div/div[4]/table/tbody/tr[1]"
                )))
            driver.find_element_by_xpath(
                ".//*[@id='content']/div/div[3]/div[2]/div/div/div[4]/table/tbody/tr/td[1]/a"
            ).click()
            wait = WebDriverWait(driver, 80)
            driver.find_element_by_xpath(
                ".//*[@id='content']/div/div[3]/div[2]/div/header/div/button"
            ).click()
            wait.until(
                EC.visibility_of_element_located(
                    (By.XPATH,
                     "html/body/div[2]/div/div/div[2]/div[2]/button[1]")))
            driver.find_element_by_xpath(
                "html/body/div[2]/div/div/div[2]/div[2]/button[1]").click()
            wait.until(
                EC.visibility_of_element_located((By.ID, "search-users")))
            driver.find_element_by_xpath(
                ".//*[@id='content']/div/div[3]/div[1]/div/nav/div/div[4]"
            ).click()
            print "All Created users are Deactivated"
Beispiel #6
0
    def searchTracksAndSelect(self, trackName):

        wait = WebDriverWait(driver, 60)
        wait.until(
            EC.visibility_of_element_located((By.XPATH, "//li[1]/div[1]")))
        driver.find_element_by_xpath(
            ".//*[@id='search-objectives-in-modal']").send_keys(trackName)
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH, "(//li/div[2]/h4[.='" + trackName +
                 "']/../../div[1]/div)[1]")))

        driver.find_element_by_xpath("(//li/div[2]/h4[.='" + trackName +
                                     "']/../../div[1]/div)[1]").click()
Beispiel #7
0
    def editCreatedLesson(self):   
        
        wait=WebDriverWait(driver, 60)
        wait.until(EC.visibility_of_element_located((By.XPATH,"//a[@href='/create/lessons']")))

        print "Clicking on Lessons button from side menu"
        driver.find_element_by_xpath("//a[@href='/create/lessons']").click()
    
        wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div[3]/div[2]/div/header/div/button")))  
        print "Clicking on Create Lesson button from lessons page"
        driver.find_element_by_xpath(".//*[@id='content']/div/div[3]/div[2]/div/header/div/button").click()
       
        wait.until(EC.visibility_of_element_located((By.XPATH,"html/body/div[2]/div/div/div[2]/div[2]/div/div")))  
        
        print "Clicking on BlankLesson + icon from Create a new lesson pop up"
        driver.find_element_by_xpath("html/body/div[2]/div/div/div[2]/div[2]/div/div").click()
       
        book=xlrd.open_workbook(os.path.join('TestData.xlsx'))
        first_sheet = book.sheet_by_name('MultiCardLesson')
          
        cell1= first_sheet.cell(59,0)
        global lesson_title
        lesson_title = cell1.value   

        wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div/div[3]/div[3]/div[1]/div[1]/span")))  
        driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/h1/textarea").send_keys(lesson_title)
        print "Entering the lesson title in title card as"+" "+lesson_title
        
        wait.until(EC.visibility_of_element_located((By.XPATH,"//span[@class='lesson-editor-status' and .='Saving...']")))
        wait.until(EC.visibility_of_element_located((By.XPATH,"//span[@class='lesson-editor-status' and .='Saved']"))) 
    def addImageCard(self, Imagefilepath1, linkname, Imagefilepath2, time):

        wait = WebDriverWait(driver, time)
        driver.find_element_by_xpath(
            ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[2]/div/div"
        ).click()

        print "Clicking on Add card + icon"
        driver.find_element_by_xpath(
            ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[2]/div/div[2]/div[1]/div[2]/div[1]/div"
        ).click()

        print "Image card selected"
        wait.until(
            EC.visibility_of_element_located((
                By.XPATH,
                ".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div/div/div[1]/h4/div[1]/span[2]/div"
            )))
        #driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div/div/div[1]/h4/div[1]/span[2]/div").click()
        #print "Clicking on browse for your file link"

        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "//span[@class='lesson-editor-status' and .='Saving...']")))
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "//span[@class='lesson-editor-status' and .='Saved']")))

        print "Going to upload the image file"
        driver.find_element_by_css_selector('input[type="file"]').send_keys(
            Imagefilepath1)
        wait.until(
            EC.visibility_of_element_located((
                By.XPATH,
                ".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div/div[1]/img"
            )))

        imageContainerlocator_after1upload = driver.find_element_by_xpath(
            ".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div/div[1]/img"
        )

        if (imageContainerlocator_after1upload.is_displayed()):
            print 'Successfully uploaded the image1 file'
        else:
            print "Failed to upload the image1 file"
            raise Exception
Beispiel #9
0
 def successMessage(self):
     wait = WebDriverWait(driver, 60)
     wait.until(
         EC.element_to_be_clickable(
             (By.XPATH, ".//*[@id='content']/div/div[2]/div/div/span")))
     return driver.find_element_by_xpath(
         ".//*[@id='content']/div/div[2]/div/div/span").text
Beispiel #10
0
    def createCreatorUserLogin(self):
        print "Reading data from excel sheet"
        book = xlrd.open_workbook(os.path.join('TestData.xlsx'))
        first_sheet = book.sheet_by_name('CreateuserfromUI')
        print(
            "Fetching the First Name, LastName,Email,EmployeeId and password from Excel Sheet\n"
        )
        # read a cell

        cell = first_sheet.cell(2, 3)
        Email = cell.value
        print Email

        cell = first_sheet.cell(2, 6)
        Password = cell.value
        print Password

        cell = first_sheet.cell(2, 7)
        NewPassword = cell.value
        print NewPassword

        wait = WebDriverWait(driver, 60)
        print "Grovo Sign-In page is displayed"

        print "Entering User name"
        driver.find_element_by_xpath(".//*[@id='username']").send_keys(Email)

        print "Entering Password"
        element = WebDriverWait(driver, 10).until(
            EC.presence_of_element_located((By.ID, "password")))
        element.send_keys(Password)

        element.send_keys(Keys.TAB)
        print "Clicking on Sign_In button"
        driver.find_element_by_xpath("//*[@id='submitButton']").click()
        wait.until(EC.visibility_of_element_located(
            (By.ID, "currentPassword")))
        driver.find_element_by_id("currentPassword").send_keys(Password)
        print "Current Password is entered :" + Password
        driver.find_element_by_id("newPassword").send_keys(NewPassword)
        print "New Password is entered :" + NewPassword
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "html/body/div[2]/div/div/div[2]/div[1]/div[2]/button")))
        driver.find_element_by_xpath(
            "html/body/div[2]/div/div/div[2]/div[1]/div[2]/button").click()
        wait.until(
            EC.visibility_of_element_located((By.ID, "global-header-search")))
        print "Home Page is Loaded"
        print "Sign out "
        ele = driver.find_element_by_xpath(
            ".//*[@id='content']/div/div[1]/div[1]/nav/div[2]/a/span[3]")
        driver.execute_script('arguments[0].click()', ele)
        elem = driver.find_element_by_xpath(
            "html/body/div/div/div[1]/div[2]/div[2]/a")
        driver.execute_script('arguments[0].click()', elem)
Beispiel #11
0
 def Logincreateuser(self):
     print "Reading data from excel sheet"
     book = xlrd.open_workbook(os.path.join('TestData.xlsx'))
     sheet1 = book.sheet_by_name('API testing')
     cell2 = sheet1.cell(1, 2)
     Currentpassword = cell2.value
     cell3 = sheet1.cell(1, 3)
     Newpassword = cell3.value
     wait = WebDriverWait(driver, 80)
     print "Grovo Sign-In page is displayed"
     print "Enter User name"
     driver.find_element_by_id("username").send_keys(email)
     print "Enter Password"
     element = WebDriverWait(driver, 10).until(
         EC.presence_of_element_located((By.ID, "password")))
     element.send_keys(Currentpassword)
     element.send_keys(Keys.TAB)
     print "Clicking on Sign_In button"
     driver.find_element_by_xpath("//*[@id='submitButton']").click()
     wait.until(EC.visibility_of_element_located(
         (By.ID, "currentPassword")))
     driver.find_element_by_id("currentPassword").send_keys(Currentpassword)
     print "Current Password is entered :" + Currentpassword
     driver.find_element_by_id("newPassword").send_keys(Newpassword)
     print "New Password is entered :" + Newpassword
     wait.until(
         EC.visibility_of_element_located(
             (By.XPATH,
              "html/body/div[2]/div/div/div[2]/div[1]/div[2]/button")))
     driver.find_element_by_xpath(
         "html/body/div[2]/div/div/div[2]/div[1]/div[2]/button").click()
     wait.until(
         EC.visibility_of_element_located(
             (By.XPATH,
              ".//*[@id='content']/div/div[1]/div/nav/div[1]/a[2]/span")))
     print "Home Page is Loaded"
     expectedresult = "Home"
     expectedresult1 = "Library"
     actualresult = driver.find_element_by_xpath(
         ".//*[@id='content']/div/div[1]/div/nav/div[1]/a[2]/span").text
     actualresult1 = driver.find_element_by_xpath(
         ".//*[@id='content']/div/div[1]/div/nav/div[1]/a[3]/span").text
     if (expectedresult == actualresult):
         if (expectedresult1 == actualresult1):
             print "User is able to login and Dashboard is displayed.."
     else:
         print "User not able to login.."
         raise Exception
         print Exception
     wait = WebDriverWait(driver, 80)
     print "Sign out "
     ele = driver.find_element_by_xpath(
         ".//*[@id='content']/div/div[1]/div[1]/nav/div[2]/a/span[3]")
     driver.execute_script('arguments[0].click()', ele)
     elem = driver.find_element_by_xpath(
         "html/body/div/div/div[1]/div[2]/div[2]/a")
     driver.execute_script('arguments[0].click()', elem)
Beispiel #12
0
    def searchingForlesson(self, campName):
        wait = WebDriverWait(driver, 60)
        campButton = wait.until(
            EC.element_to_be_clickable(
                (By.XPATH,
                 ".//*[@id='content']/div/div[3]/div[2]/div/div[1]/a")))

        campButton.click()
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH, ".//*[@id='search-campaigns-in-table']")))
        driver.find_element_by_xpath(
            ".//*[@id='search-campaigns-in-table']").send_keys(campName)

        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH, "(//tbody/tr/td[1]/a[.='" + campName + "'])[1]")))
Beispiel #13
0
 def addVideoCardforedit(self,time):
     
     wait=WebDriverWait(driver, time)
     wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[2]/div/div")))
     driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[2]/div/div").click()
     
     print "Clicking on Add card + icon"
     driver.find_element_by_xpath("html/body/div/div/div/div[3]/div[3]/div[2]/div[2]/div/div[2]/div[1]/div[3]/div[1]").click()
     
             
     book=xlrd.open_workbook(os.path.join('TestData.xlsx'))
     first_sheet = book.sheet_by_name('MultiCardLesson')
     cell7= first_sheet.cell(1,8)
     videoName = cell7.value 
     
     
     
     #Uploading Video
     print "Uploading Video"
     driver.find_element_by_css_selector('input[type="file"]').send_keys(videoName)
     wait.until(EC.visibility_of_element_located((By.XPATH,"html/body/div[1]/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div/div[1]/div[1]/button")))
     
     videoContainerlocator_afterupload= driver.find_element_by_xpath("html/body/div[1]/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div/div[1]/div[1]/button")
     
     if(videoContainerlocator_afterupload.is_displayed()):
         print 'Successfully uploaded the Video file'
     else:
         print "Failed to upload the Video file"
         raise Exception
     
     driver.find_element_by_xpath("html/body/div[1]/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div/div[1]/div[1]/button").click()
     wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[2]/div/div")))
    def deleteItLesson(self):
        wait = WebDriverWait(driver, 80)
        #wait.until(EC.visibility_of_element_located((By.XPATH,"//tr[1]/td[4]/button[.='Delete']")))

        time.sleep(3)
        wait.until(
            EC.element_to_be_clickable(
                (By.XPATH, "//tr[1]/td[4]/button[.='Delete']")))
        driver.find_element_by_xpath(
            "//tr[1]/td[4]/button[.='Delete']").click()
        delo = wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "html/body/div[2]/div/div/div[2]/div[2]/button[1]")))
        delo.click()
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH, ".//*[@id='content']/div/div[2]/div/div/span")))
    def mainDeletetag(self):
        try:
            d = Delete_Tags_Attributes_Lessons()
            wait = WebDriverWait(driver, 80)
            wait.until(
                EC.visibility_of_element_located((
                    By.XPATH,
                    "html/body/div/div/div[3]/div[1]/div/nav/div/div[2]/div[6]/a"
                )))
            driver.find_element_by_xpath(
                "html/body/div/div/div[3]/div[1]/div/nav/div/div[2]/div[6]/a"
            ).click()
            print "Clicked on admin icon"
            wait.until(
                EC.visibility_of_element_located((
                    By.XPATH,
                    "html/body/div/div/div[3]/div[1]/div/nav/div/div[2]/div[6]"
                )))
            driver.find_element_by_xpath(
                "html/body/div/div/div[3]/div[1]/div/nav/div/div[2]/div[6]"
            ).click()
            print "Clicked on Admin"
            driver.find_element_by_xpath(
                "html/body/div/div/div[3]/div[1]/div/nav/div/div[2]/div[6]/div/ul/li[5]"
            ).click()
            print "Clicked on Tag"
            time.sleep(5)

            count = driver.find_element_by_xpath(
                "//*[@id='content']/div/div[3]/div[2]/div/div/section[2]/ul/li[1]/span"
            ).text
            print count

            if count == '0':
                print "No Tags to delete"
            else:
                wait.until(
                    EC.visibility_of_element_located(
                        (By.XPATH, "//li[@class='u-inline-block']/a")))
                ele = driver.find_elements_by_xpath(
                    "//li[@class='u-inline-block']/a")
                count = len(ele)

                wait.until(
                    EC.visibility_of_element_located((
                        By.XPATH,
                        "html/body/div/div/div[3]/div[2]/div/div/section[2]/div/ul/li[1]/a"
                    )))
                print "Tag Page Loaded"

                for count in range(0, count):
                    d.delete_Tag()
                print "All Tags are deleted"
        finally:
            book = xlrd.open_workbook(os.path.join('TestData.xlsx'))
            second_sheet = book.sheet_by_name('Login_Credentials')
            cell = second_sheet.cell(1, 1)
            url = cell.value
            driver.get(url)
Beispiel #16
0
 def campaignDetailPageHeaderText(self):
     wait = WebDriverWait(driver, 60)
     wait.until(
         EC.element_to_be_clickable((
             By.XPATH,
             ".//*[@id='content']/div/div[3]/div[2]/div/header/div[1]/h1/em"
         )))
     return driver.find_element_by_xpath(
         ".//*[@id='content']/div/div[3]/div[2]/div/header/div[1]/h1/em"
     ).text
 def Logincreateuser(self):    
     print "Reading data from excel sheet"
     book=xlrd.open_workbook(os.path.join('TestData.xlsx'))
     sheet1=book.sheet_by_name('API testing')
     cell2 = sheet1.cell(2,2)
     Currentpassword = cell2.value
     cell3 = sheet1.cell(2,3)
     Newpassword = cell3.value
     wait=WebDriverWait(driver, 80)
     print "Grovo Sign-In page is displayed"
     print "Enter User name"
     driver.find_element_by_id("username").send_keys(email) 
     print "Enter Password"
     element = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "password")))
     element.send_keys(Currentpassword)
     element.send_keys(Keys.TAB)
     print "Clicking on Sign_In button"
     driver.find_element_by_xpath("//*[@id='submitButton']").click()
     wait.until(EC.visibility_of_element_located((By.ID,"currentPassword")))
     driver.find_element_by_id("currentPassword").send_keys(Currentpassword)
     print "Current Password is entered :"+Currentpassword
     driver.find_element_by_id("newPassword").send_keys(Newpassword)
     print "New Password is entered :"+Newpassword
     wait.until(EC.visibility_of_element_located((By.XPATH,"html/body/div[2]/div/div/div[2]/div[1]/div[2]/button")))
     driver.find_element_by_xpath("html/body/div[2]/div/div/div[2]/div[1]/div[2]/button").click()
     wait.until(EC.visibility_of_element_located((By.ID,"global-header-search")))
     Home=driver.find_element_by_xpath("html/body/div/div/div[3]/div[1]/div/nav/div/div[2]/div[1]")
     Library = driver.find_element_by_xpath("html/body/div/div/div[3]/div[1]/div/nav/div/div[2]/div[2]")
     Create = driver.find_element_by_xpath("html/body/div/div/div[3]/div[1]/div/nav/div/div[2]/div[3]")
     Campaign = driver.find_element_by_xpath("html/body/div/div/div[3]/div[1]/div/nav/div/div[2]/div[4]")
     if(Home.is_displayed() and Library.is_displayed() and Create.is_displayed() and Campaign.is_displayed()):
         print "User with Creator Role is able to login and HOME,LIBRARY,CREATE and CAMPAIGN is displaying.."
     else:
         print"Home page not displayed"
         raise Exception
         print Exception
     print "Sign out "
     ele =driver.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[1]/nav/div[2]/a/span[3]")
     driver.execute_script('arguments[0].click()',ele)
     elem=driver.find_element_by_xpath("html/body/div/div/div[1]/div[2]/div[2]/a")
     driver.execute_script('arguments[0].click()',elem)
    def deleteAttribute(self):

        wait = WebDriverWait(driver, 60)
        driver.find_element_by_xpath(
            "//tr[1]/td[5]/button[.='Delete']").click()

        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "html/body/div[2]/div/div/div[2]/div[2]/button[1]")))
        wait.until(
            EC.element_to_be_clickable(
                (By.XPATH,
                 "html/body/div[2]/div/div/div[2]/div[2]/button[1]")))
        driver.find_element_by_xpath(
            "html/body/div[2]/div/div/div[2]/div[2]/button[1]").click()

        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH, "html/body/div/div/div[2]/div/div")))
        time.sleep(3)
Beispiel #19
0
    def addDocumentCard(self, document1Path, time):

        wait = WebDriverWait(driver, time)

        driver.find_element_by_xpath(
            ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[2]/div/div"
        ).click()
        print "Clicking on Add card + icon"

        driver.find_element_by_xpath(
            ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[2]/div/div[2]/div[1]/div[4]/div[1]/div"
        ).click()
        print "Selecting the Document card"

        driver.find_element_by_css_selector('input[type="file"]').send_keys(
            document1Path)
        print "Uploading document file"

        #wait till minimize button is displayed

        wait.until(
            EC.visibility_of_element_located((
                By.XPATH,
                ".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div/div[1]/div[1]/div[1]/button[1]"
            )))

        downloadButtonLocator = driver.find_element_by_xpath(
            ".//*[@id='content']/div/div/div[3]/div[2]/div/div/div[1]/div/a")

        if (downloadButtonLocator.is_displayed()):

            print "The file has been uploaded successfully"

        else:

            print "Failed to upload the file"
            raise Exception

        # Going to delete the uploaded file
        ''' driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div/div[2]/button").click()
 def textCard(self,textCard):
     print "Text card"
     print "Click on (+) icon"
         
     driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[2]/div/div/span").click()
 
     driver.find_element_by_xpath("html/body/div/div/div/div[3]/div[3]/div[2]/div[2]/div/div[2]/div[1]/div[1]/div[1]").click()
         
     textCardelement=driver.find_element_by_xpath("//div[@class='text']/div/div[1]/div")
         
     #Entering Text in Text card 
         
     webdriver.ActionChains(driver).move_to_element(textCardelement).click().send_keys(textCard).perform()
     wait=WebDriverWait(driver, 60)
     wait.until(EC.visibility_of_element_located((By.XPATH,"//span[@class='lesson-editor-status' and .='Saving...']")))
     wait.until(EC.visibility_of_element_located((By.XPATH,"//span[@class='lesson-editor-status' and .='Saved']")))
         
     #Verifying entered text is displaying text card
     print "Verifying entered text is displaying text card"
         
     textAfterEntering=driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div/div/span/span").text
         
     if textAfterEntering==textCard:
         print "Verified Text '"+textCard+"' is displayed in Text Card"
     else:
         print "Text not displayed in Text card"
         raise Exception
    def delete_Tag(self):

        wait = WebDriverWait(driver, 60)
        wait.until(
            EC.visibility_of_element_located((
                By.XPATH,
                "html/body/div/div/div[3]/div[2]/div/div/section[2]/div/ul/li[1]/a"
            )))
        driver.find_element_by_xpath(
            "html/body/div/div/div[3]/div[2]/div/div/section[2]/div/ul/li[1]/a"
        ).click()
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "html/body/div/div/div[3]/div[2]/div/header/div/button")))
        driver.find_element_by_xpath(
            "html/body/div/div/div[3]/div[2]/div/header/div/button").click()
        print "Clicked on Delete Button"
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH, "html/body/div[2]/div/div/div[2]/div/button[1]")))
        wait.until(
            EC.element_to_be_clickable(
                (By.XPATH, "html/body/div[2]/div/div/div[2]/div/button[1]")))
        driver.find_element_by_xpath(
            "html/body/div[2]/div/div/div[2]/div/button[1]").click()

        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH, "html/body/div/div/div[2]/div/div")))
        time.sleep(3)
    def addQuestionCard(self, questionCard, ans1, ans2):

        wait = WebDriverWait(driver, 60)
        wait.until(
            EC.visibility_of_element_located((
                By.XPATH,
                ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[2]/div/div"
            )))
        driver.find_element_by_xpath(
            ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[2]/div/div"
        ).click()

        print "Clicking on Add card + icon"
        driver.find_element_by_xpath(
            ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[2]/div/div[2]/div[1]/div[5]/div[1]/div"
        ).click()

        print "Question card selected"
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH, ".//*[@id='question-answer-input-0']")))

        print "Entering question"
        ele = driver.find_element_by_xpath(
            ".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div/p/textarea"
        )
        ele.send_keys(questionCard)

        print "Entering first answer"
        driver.find_element_by_xpath(
            ".//*[@id='question-answer-input-0']").send_keys(ans1)

        print "Entering Second answer"
        driver.find_element_by_xpath(
            ".//*[@id='question-answer-input-1']").send_keys(ans2)

        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "//span[@class='lesson-editor-status' and .='Saving...']")))
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "//span[@class='lesson-editor-status' and .='Saved']")))
Beispiel #23
0
    def lessonWithTitletCard(self, lesson_title):

        wait = WebDriverWait(driver, 60)
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH, "//a[@href='/create/lessons']")))

        print "Clicking on Lessons button from side menu"
        driver.find_element_by_xpath("//a[@href='/create/lessons']").click()

        wait = WebDriverWait(driver, 60)
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 ".//*[@id='content']/div/div[3]/div[2]/div/header/div/button"
                 )))
        print "Clicking on Create Lesson button from lessons page"
        driver.find_element_by_xpath(
            ".//*[@id='content']/div/div[3]/div[2]/div/header/div/button"
        ).click()

        wait = WebDriverWait(driver, 60)
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH, "html/body/div[2]/div/div/div[2]/div[2]/div/div")))
        print "Clicking on BlankLesson + icon from Create a new lesson pop up"
        driver.find_element_by_xpath(
            "html/body/div[2]/div/div/div[2]/div[2]/div/div").click()

        wait = WebDriverWait(driver, 60)
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 ".//*[@id='content']/div/div/div[3]/div[3]/div[1]/div[1]/span"
                 )))
        driver.find_element_by_xpath(
            ".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/h1/textarea"
        ).send_keys(lesson_title)
        print "Entering the lesson title in title card as" + " " + lesson_title

        wait = WebDriverWait(driver, 60)
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "//span[@class='lesson-editor-status' and .='Saving...']")))
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "//span[@class='lesson-editor-status' and .='Saved']")))
Beispiel #24
0
    def mainDelete(self):
        try:
            d = DeleteLesson()
            print "\n\nDeleting all lessons.........."
            wait = WebDriverWait(driver, 60)
            wait.until(
                EC.visibility_of_element_located(
                    (By.XPATH, "//a[@href='/create/lessons']")))

            print "Clicking on Lessons button from side menu"
            driver.find_element_by_xpath(
                "//a[@href='/create/lessons']").click()

            wait = WebDriverWait(driver, 60)
            wait.until(
                EC.visibility_of_element_located(
                    (By.XPATH,
                     "//tbody/tr/td[.='Published']/../td[4]/button[3]")))
            ele = driver.find_elements_by_xpath(
                "//tbody/tr/td[.='Published']/../td[4]/button[3]")
            print "Deleting Lesson"
            count = len(ele)

            for count in range(0, count):
                d.deleteIt()

            print "All Elements are deleted"

        except Exception as e:
            traceback.print_exc()
            print(e)
            raise Exception
        finally:
            book = xlrd.open_workbook(os.path.join('TestData.xlsx'))
            second_sheet = book.sheet_by_name('Login_Credentials')
            cell = second_sheet.cell(1, 1)
            url = cell.value
            driver.get(url)
Beispiel #25
0
 def lessonWithTextCardforedit(self):   
     
     wait=WebDriverWait(driver, 60)
     driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[2]/div/div").click()
     
     book=xlrd.open_workbook(os.path.join('TestData.xlsx'))
     first_sheet = book.sheet_by_name('MultiCardLesson')
     cell2= first_sheet.cell(59,1)
     TextContent = cell2.value 
     
     print "Clicking on Add card + icon"  
     driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[2]/div/div[2]/div[1]/div[1]/div[1]/div").click()
     
     print "Clicking on Text card"    
     wait.until(EC.visibility_of_element_located((By.XPATH,"//span[@class='lesson-editor-status' and .='Saving...']")))
     wait.until(EC.visibility_of_element_located((By.XPATH,"//span[@class='lesson-editor-status' and .='Saved']"))) 
     
     element = driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div")
     webdriver.ActionChains(driver).move_to_element(element).click().send_keys(TextContent).perform()
     
     print "Entering the text as"+ " "+TextContent 
     wait.until(EC.visibility_of_element_located((By.XPATH,"//span[@class='lesson-editor-status' and .='Saving...']")))
     wait.until(EC.visibility_of_element_located((By.XPATH,"//span[@class='lesson-editor-status' and .='Saved']"))) 
 def videoCard(self,videoPath,timeToUploadVideo):
     print "Click on (+) icon"
     
     driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[2]/div/div/span").click()
     
     #Clicking on Video card
     driver.find_element_by_xpath("html/body/div/div/div/div[3]/div[3]/div[2]/div[2]/div/div[2]/div[1]/div[3]/div[1]").click()
     
     #Uploading Video
     print "Uploading Video"
     driver.find_element_by_css_selector('input[type="file"]').send_keys(videoPath)
     
     WebDriverWait(driver, timeToUploadVideo).until(EC.visibility_of_element_located((By.XPATH,"html/body/div[1]/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div/div[1]/div[1]/button")))
     
     videoContainerlocator_afterupload= driver.find_element_by_xpath("html/body/div[1]/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div/div[1]/div[1]/button")
     
     if(videoContainerlocator_afterupload.is_displayed()):
         
         print "Successfully uploaded the Video file"
         
     else:
         print "Failed to upload the Video file"
         raise Exception
Beispiel #27
0
    def deleteIt(self):
        wait = WebDriverWait(driver, 60)
        #wait.until(EC.visibility_of_element_located((By.XPATH,"//tr[1]/td[4]/button[.='Delete']")))

        driver.refresh()
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "(//tbody/tr/td[.='Published']/../td[4]/button[3])[1]")))
        wait.until(
            EC.element_to_be_clickable(
                (By.XPATH,
                 "(//tbody/tr/td[.='Published']/../td[4]/button[3])[1]")))
        driver.find_element_by_xpath(
            "(//tbody/tr/td[.='Published']/../td[4]/button[3])[1]").click()
        delo = wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "html/body/div[2]/div/div/div[2]/div[2]/button[1]")))
        delo.click()
        wait.until(
            EC.invisibility_of_element_located(
                (By.XPATH, "html/body/div[2]/div/div/div[1]/button")))
Beispiel #28
0
    def publishLesson(self): 
      
        wait=WebDriverWait(driver, 60)
        
        book=xlrd.open_workbook(os.path.join('TestData.xlsx'))
        first_sheet = book.sheet_by_name('MultiCardLesson')
        cell32= first_sheet.cell(33,2)
        lesson_title_TeachASkill = cell32.value
        #wait.until(EC.visibility_of_element_located((By.XPATH,"//span[@class='lesson-editor-status' and .='Saving...']")))
        #wait.until(EC.visibility_of_element_located((By.XPATH,"//span[@class='lesson-editor-status' and .='Saved']"))) 
      
        wait.until(EC.element_to_be_clickable((By.XPATH,".//*[@id='content']/div/div/div[3]/div[3]/div[1]/div[3]/div[3]/button")))
        driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[1]/div[3]/div[3]/button").click()
        print "Clicking on READY TO PUBLISH button"
        
        wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div/div[3]/div[3]/div[1]/div[3]/div[3]/div/div[1]/section[3]/div/button[1]")))
        driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[1]/div[3]/div[3]/div/div[1]/section[3]/div/button[1]").click()
        print "Clicking on PUBLISH button"
        
        #print "Validating the success message after publish"
        # wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div/div[2]/div/div/span[2]"))) 
        #actual_success_message= driver.find_element_by_xpath(".//*[@id='content']/div/div/div[2]/div/div/span[2]").text
       # expected_success_message= "You have successfully published \"" + lesson_title_TeachASkill + "\""; 
        
        #if(expected_success_message==actual_success_message):
            #print "The success message is displaying as"+ " "+expected_success_message
        #else:
            #print "The success message is not displaying as expected"
            
        driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[1]/a").click()
        print "Clicking on EXIT button"
             
        print "Verifying lesson displayed in Grid"
        wait.until(EC.visibility_of_element_located((By.XPATH,"(//tbody/tr/td[2]/a[.='"+lesson_title_TeachASkill+"'])[1]")))

        if driver.find_element_by_xpath("(//tbody/tr/td[2]/a[.='"+lesson_title_TeachASkill+"'])[1]").is_displayed():
            print "Lesson is displayed in Grid ::"+lesson_title_TeachASkill
        else:
            print "Lesson not displaying in grid"
            raise Exception
        
        driver.find_element_by_xpath(".//*[@id='content']/div/div[3]/div[1]/div/nav/div/div[4]").click()
    def lessonWithTextCard(self, TextContent):

        wait = WebDriverWait(driver, 60)
        driver.find_element_by_xpath(
            ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[2]/div/div"
        ).click()

        print "Clicking on Add card + icon"
        driver.find_element_by_xpath(
            ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[2]/div/div[2]/div[1]/div[1]/div[1]/div"
        ).click()

        print "Clicking on Text card"
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "//span[@class='lesson-editor-status' and .='Saving...']")))
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "//span[@class='lesson-editor-status' and .='Saved']")))

        element = driver.find_element_by_xpath(
            ".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div"
        )
        webdriver.ActionChains(driver).move_to_element(
            element).click().send_keys(TextContent).perform()

        print "Entering the text as" + " " + TextContent
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "//span[@class='lesson-editor-status' and .='Saving...']")))
        wait.until(
            EC.visibility_of_element_located(
                (By.XPATH,
                 "//span[@class='lesson-editor-status' and .='Saved']")))
 def imageCard(self,Imagefilepath1):
     print "\nUploading Image"
     wait=WebDriverWait(driver, 60)
     print "Click on (+) icon"
     
     driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[2]/div/div/span").click()
     
     #Clicking on Image card
     driver.find_element_by_xpath("html/body/div/div/div/div[3]/div[3]/div[2]/div[2]/div/div[2]/div[1]/div[2]/div[1]").click()
     
     #Uploading image
     driver.find_element_by_css_selector('input[type="file"]').send_keys(Imagefilepath1)
     
     wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div/div[1]/img")))
     
     imageContainerlocator_after1upload= driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div/div[1]/img")
     
     if(imageContainerlocator_after1upload.is_displayed()):
         
         print 'Successfully uploaded the image1 file'
         
     else:
         print "Failed to upload the image1 file"
         raise Exception