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)
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"
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 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 lessonExplainAConcepts(self, exNumberOfCards): 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() # Going to verify EXPLAIN A CONCEPT Template print "Going to verify the display of EXPLAIN A CONCEPT Teamplate" wait.until( EC.visibility_of_element_located( (By.XPATH, "html/body/div[2]/div/div/div[2]/div[3]/div/div"))) explainACoceptLocator = driver.find_element_by_xpath( "html/body/div[2]/div/div/div[2]/div[3]") if (explainACoceptLocator.is_displayed() and explainACoceptLocator.text == "EXPLAIN A CONCEPT"): print "The EXPLAIN A CONCEPT Template is displaying in Create a new lesson pop up" else: print "Failed to find the EXPLAIN A CONCEPT Template in Create a new lesson pop up" raise Exception # Going to Click on EXPLAIN A CONCEPT Template print "Clicking on EXPLAIN A CONCEPT Template" driver.find_element_by_xpath( "html/body/div[2]/div/div/div[2]/div[3]/div/div").click() 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/h1/textarea" ))) # Going to check for the count of displayed lesson cards cardsDisplayed = driver.find_elements_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[1]/div/div" ) actualNumberOfCards = len(cardsDisplayed) if (actualNumberOfCards == exNumberOfCards): print "The cards count is displaying as expected" + " " + str( exNumberOfCards) else: print "Failed to find the card count as expected" raise Exception # Going to verify the title card content print "Going to verify the title card content" book = xlrd.open_workbook(os.path.join('TestData.xlsx')) first_sheet = book.sheet_by_name('MultiCardLesson') cell1 = first_sheet.cell(21, 0) exTitleCardContent = cell1.value actualTitleCardContent = driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/h1/textarea" ).text if (exTitleCardContent == actualTitleCardContent): print "The title card label is displaying as expected" + " " + '"' + exTitleCardContent + '"' else: print "Failed to find the expected label in title card" raise Exception # Going to clear the Title present in the title card print "Going to clear the lesson title" driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/h1/textarea" ).click() for i in range(55): 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(Keys.BACKSPACE) print "Entering the title for lesson" cell32 = first_sheet.cell(30, 0) title = cell32.value 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(title) # Clicking on Second card print "Clicking on Second card" driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[1]/div/div[2]" ).click() 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/div[2]/div/div/div/div/div" ))) # Going to verify the content in Second card print "Going to verify the content in second card" cell2 = first_sheet.cell(21, 1) exFirstCardContent1 = cell2.value cell3 = first_sheet.cell(21, 2) exFirstCardContent2 = cell3.value cell4 = first_sheet.cell(21, 3) exFirstCardContent3 = cell4.value cell5 = first_sheet.cell(21, 4) exFirstCardContent4 = cell5.value cell6 = first_sheet.cell(21, 5) exFirstCardContent5 = cell6.value cell7 = first_sheet.cell(21, 6) exFirstCardContent6 = cell7.value actualFirstCardContent1 = 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[1]/div/span/span/span" ).text actualFirstCardContent2 = 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[3]/div/span[1]/span/span" ).text actualFirstCardContent3 = 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[3]/div/span[2]/span/span" ).text actualFirstCardContent4 = 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[3]/div/span[4]/span[1]/span" ).text actualFirstCardContent5 = 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[3]/div/span[4]/span[2]/span" ).text actualFirstCardContent6 = 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[5]/div/span/span/span" ).text if (exFirstCardContent1 == exFirstCardContent1): if (exFirstCardContent2 == exFirstCardContent2): if (exFirstCardContent3 == exFirstCardContent3): if (exFirstCardContent4 == exFirstCardContent4): if (exFirstCardContent5 == exFirstCardContent5): if (exFirstCardContent6 == exFirstCardContent6): print "The second card content is displaying as expected" else: print "Failed to find the expected content in second card" raise Exception # Clicking on > icon print "Clicking on > arrow for Third card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[3]/div" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[3]/div" ).click() # Clicking on Third card print "Clicking on Third card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[3]/div/div[1]" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[3]/div/div[1]" ).click() # Going to verify the content in Third card 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/div[2]/div/div/div/div/div" ))) print "Going to verify the content in Third card" cell8 = first_sheet.cell(22, 0) exSecondCardContent1 = cell8.value actualSecondCardContent1 = 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[1]/div/span/span[1]/span" ).text cell9 = first_sheet.cell(22, 1) exSecondCardContent2 = cell9.value actualSecondCardContent2 = 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[1]/div/span/span[2]/span" ).text cell10 = first_sheet.cell(22, 2) exSecondCardContent3 = cell10.value actualSecondCardContent3 = 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[3]/div/span/span/span" ).text cell11 = first_sheet.cell(22, 3) exSecondCardContent4 = cell11.value actualSecondCardContent4 = 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[4]/div/span/span/span" ).text if (exSecondCardContent1 == actualSecondCardContent1): if (exSecondCardContent2 == actualSecondCardContent2): if (exSecondCardContent3 == actualSecondCardContent3): if (exSecondCardContent4 == actualSecondCardContent4): print "The Third card content is displaying as expected" else: print "Failed to find the expected content in Third card" raise Exception # Clicking on < icon print "Clicking on < arrow for Fourth card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[1]/div" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[1]/div" ).click() # Clicking on Fourth card print "Clicking on Fourth card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[4]/div/div[1]" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[4]/div/div[1]" ).click() # Going to verify the content in Fourth card card print "Going to verify the content in Fourth card" cell12 = first_sheet.cell(23, 0) exThirdCardContent = cell12.value 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/div[2]/div/div/div/div/div/div/span/span/span" ))) actualThirdCardContent = 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/span" ).text if (exThirdCardContent in actualThirdCardContent): print "The Fourth card content is displaying as expected" else: print "Failed to find the expected content in Fourth card" raise Exception # Going to click on Fifth card print "Clicking on Fifth card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[5]/div/div[1]" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[5]/div/div[1]" ).click() # Verifying Fifth card labels print "Going to verify the content in Fifth card" 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/div[2]/div/div/div/div/div" ))) cell13 = first_sheet.cell(24, 0) exFourthCardContent1 = cell13.value cell14 = first_sheet.cell(24, 1) exFourthCardContent2 = cell14.value cell15 = first_sheet.cell(24, 2) exFourthCardContent3 = cell15.value cell16 = first_sheet.cell(24, 3) exFourthCardContent4 = cell16.value cell17 = first_sheet.cell(24, 4) exFourthCardContent5 = cell17.value actualFourthCardContent1 = 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[1]/div/span/span[1]/span" ).text actualFourthCardContent2 = 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[1]/div/span/span[2]/span" ).text actualFourthCardContent3 = 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[1]/div/span/span[3]/span" ).text actualFourthCardContent4 = 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[3]/div/span" ).text actualFourthCardContent5 = 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[4]/div/span/span/span" ).text if (exFourthCardContent1 == actualFourthCardContent1): if (exFourthCardContent2 == actualFourthCardContent2): if (exFourthCardContent3 == actualFourthCardContent3): if (exFourthCardContent4 == actualFourthCardContent4): if (exFourthCardContent5 == actualFourthCardContent5): print "The Fifth card content is displaying as expected" else: print "Failed to find the expected content in Fifth card" raise Exception # Going to click on Sixth card print "Clicking on Sixth card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[6]/div/div[1]" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[6]/div/div[1]" ).click() # Verifying Sixth card labels print "Going to verify the content in Sixth card" 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/div[2]/div/div/div/div/div/div/span/span/span" ))) actualFifthCradContent = 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/span" ).text cell18 = first_sheet.cell(25, 0) exFifthCardContent = cell18.value if (exFifthCardContent in actualFifthCradContent): print "The Sixth card content is displaying as expected" else: print "Failed to find the expected content in Sixth card" raise Exception # Going to click on Seventh card print "Clicking on Seventh card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[7]/div/div[1]" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[7]/div/div[1]" ).click() # Verifying the content in Seventh card 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/div[2]/div/div/div/div" ))) cell19 = first_sheet.cell(26, 0) exSixthCardContent1 = cell19.value cell20 = first_sheet.cell(26, 1) exSixthCardContent2 = cell20.value cell21 = first_sheet.cell(26, 2) exSixthCardContent3 = cell21.value actualSixthCradContent1 = 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[1]/div/span/span/span" ).text actualSixthCradContent2 = 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[3]/div/span/span/span" ).text actualSixthCradContent3 = 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[4]/div/span/span/span" ).text if (exSixthCardContent1 == actualSixthCradContent1): if (exSixthCardContent2 == actualSixthCradContent2): if (exSixthCardContent3 == actualSixthCradContent3): print "The Seventh card content is displaying as expected" else: print "Failed to find the expected content in Seventh card" raise Exception print "Clicking on > icon" driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div" ).click() # Going to Click on Eightth card print "Clicking on Eightth card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[8]/div/div[1]" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[8]/div/div[1]" ).click() # Going to verify the content in Eightth card print "Going to verify the content in Eightth card" 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/div[2]/div/div/div/div/div/div/span/span/span" ))) cell22 = first_sheet.cell(27, 0) exSeventhCardContent1 = cell22.value actualSeventhCradContent1 = 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/span" ).text if (exSeventhCardContent1 in actualSeventhCradContent1): print "The Eightth card content is displaying as expected" else: print "Failed to find the expected content in Eightth card" raise Exception # Clicking on Nineth card print "Clicking on Nineth card" driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[9]/div/div[1]" ).click() # Going to verify the content in Nineth card print "Going to verify the content in Nineth card" 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/div[2]/div/div/div/div" ))) cell23 = first_sheet.cell(28, 0) exEigtthCardContent1 = cell23.value cell24 = first_sheet.cell(28, 1) exEigtthCardContent2 = cell24.value cell25 = first_sheet.cell(28, 2) exEigtthCardContent3 = cell25.value cell26 = first_sheet.cell(28, 3) exEigtthCardContent4 = cell26.value cell27 = first_sheet.cell(28, 4) exEigtthCardContent5 = cell27.value cell28 = first_sheet.cell(28, 5) exEigtthCardContent6 = cell28.value actualEigtthCradContent1 = 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[1]/div/span/span[1]/span" ).text actualEigtthCradContent2 = 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[1]/div/span/span[2]/span" ).text actualEigtthCradContent3 = 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[1]/div/span/span[3]/span" ).text actualEigtthCradContent4 = 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[3]/div/span/span/span" ).text actualEigtthCradContent5 = 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[4]/div/span/span/span" ).text actualEigtthCradContent6 = 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[6]/div/span/span/span" ).text if (exEigtthCardContent1 == actualEigtthCradContent1): if (exEigtthCardContent2 == actualEigtthCradContent2): if (exEigtthCardContent3 == actualEigtthCradContent3): if (exEigtthCardContent4 == actualEigtthCradContent4): if (exEigtthCardContent5 == actualEigtthCradContent5): if (exEigtthCardContent6 == actualEigtthCradContent6): print "The Nineth card content is displaying as expected" else: print "Failed to find the expected content in Nineth card" raise Exception # Clicking on Ten th card print "Clicking on Ten th card " driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[10]/div/div[1]" ).click() 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']"))) # Going to verify the content in Ten th card print "Going to verify the content in Tenth card" 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/p/textarea" ))) cell29 = first_sheet.cell(29, 0) exNinethCardContent1 = cell29.value cell30 = first_sheet.cell(29, 1) exNinethCardContent2 = cell30.value cell31 = first_sheet.cell(29, 2) exNinethCardContent3 = cell31.value actualNinethCradContent1 = 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" ).get_attribute("placeholder") actualNinethCradContent2 = driver.find_element_by_xpath( ".//*[@id='question-answer-input-0']").get_attribute("placeholder") actualNinethCradContent3 = driver.find_element_by_xpath( ".//*[@id='question-answer-input-1']").get_attribute("placeholder") plusIconLocator = 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[3]/div/div[1]/div/span" ) if (exNinethCardContent1 == actualNinethCradContent1 and plusIconLocator.is_displayed()): if (exNinethCardContent2 == actualNinethCradContent2): if (exNinethCardContent3 == actualNinethCradContent3): print "The Tenth card content is displaying as expected" else: print "Failed to find the expected content in Tenth card" raise Exception wait.until( EC.visibility_of_element_located( (By.XPATH, ".//*[@id='question-answer-input-0']"))) print "Entering question" cell33 = first_sheet.cell(1, 2) questionCard = cell33.value 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" cell34 = first_sheet.cell(1, 3) ans1 = cell34.value driver.find_element_by_xpath( ".//*[@id='question-answer-input-0']").send_keys(ans1) print "Entering Second answer" cell35 = first_sheet.cell(1, 4) ans2 = cell35.value 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']")))
def userCreationWithDirectRole(self): print "Reading data from excel sheet" book=xlrd.open_workbook(os.path.join('TestData.xlsx')) sheet1=book.sheet_by_name('API testing') print("Fetching the LastName from Excel to search") #Read from Excel to search cell1 = sheet1.cell(2,1) searchlastName = cell1.value #Clicking on Admin Menu from Grovo Application wait=WebDriverWait(driver,80) wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div[3]/div[1]/div/nav/div/div[2]/div[6]/a"))) driver.find_element_by_xpath(".//*[@id='content']/div/div[3]/div[1]/div/nav/div/div[2]/div[6]/a").click() wait.until(EC.visibility_of_element_located((By.ID,"search-users"))) driver.find_element_by_id("search-users").send_keys(searchlastName) #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() #To verify FirstName field print"Verify FirstName field" wait.until(EC.visibility_of_element_located((By.ID,"create-edit-user-search-firstName"))) firstNamelocator=driver.find_element_by_id("create-edit-user-search-firstName") firstName =firstNamelocator.get_attribute("value") if not firstName: print"FirstName field is empty" else: print"FirstName is present :" +firstName #To verify LastName field print"Verify LastName field" lastNamelocator =driver.find_element_by_id("create-edit-user-search-lastName") lastName=lastNamelocator.get_attribute("value") if not lastName: print"LastName field is empty" else: print"LastName is present : "+lastName #To verify Email field print"Verify Email field" emaillocator =driver.find_element_by_id("create-edit-user-search-username") global email email =emaillocator.get_attribute("value") if not email: print"Email field is empty" else: print"Email is present : "+email #To verify Employee ID field print"Verify Employee ID field" employeeidlocator =driver.find_element_by_id("create-edit-user-search-employeeId") employeeid=employeeidlocator.get_attribute("value") if not employeeid: print"Employee ID field is empty" else: print"Employee ID is present : "+employeeid #To verify Direct Roles field print"Verify Direct Roles field" wait.until(EC.visibility_of_element_located((By.XPATH,"(//span[@role='option'])[1]"))) DirectRoleslocator =driver.find_element_by_xpath("(//span[@role='option'])[1]") DirectRoles=DirectRoleslocator.text if not DirectRoles: print"Direct Roles field is empty" else: print"Direct Roles is present : "+DirectRoles #LogOut function driver.find_element_by_xpath(".//*[@id='content']/div/div[1]/div/nav/div[2]/a/span[3]").click() print "Clicked on SignOut Dropdown" driver.find_element_by_xpath(".//*[@id='content']/div/div[1]/div[2]/div[2]/a").click() print "Clicked on signOut Button" wait.until(EC.visibility_of_element_located((By.ID,"username")))
def introduceATopic(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 = 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() print "Going to verify the display of INTRODUCE A TOPIC Teamplate" book = xlrd.open_workbook(os.path.join('TestData.xlsx')) first_sheet = book.sheet_by_name('MultiCardLesson') cell1 = first_sheet.cell(44, 0) exTemplateNameIntroduceATopic = cell1.value wait.until( EC.visibility_of_element_located( (By.XPATH, "html/body/div[2]/div/div/div[2]/div[5]/div/div"))) introduceATopiclLocator = driver.find_element_by_xpath( "html/body/div[2]/div/div/div[2]/div[5]/h4") if (introduceATopiclLocator.is_displayed() and introduceATopiclLocator.text == exTemplateNameIntroduceATopic): print "The INTRODUCE A TOPIC Template is displaying in Create a new lesson pop up" else: print "Failed to find the INTRODUCE A TOPIC Template in Create a new lesson pop up" raise Exception # Clicking on Introduce a topic template print "Clicking on INTRODUCE A TOPIC template" driver.find_element_by_xpath( "html/body/div[2]/div/div/div[2]/div[5]/div/div").click() # Going to verify the number of cards displayed for the template INTRODUCE A TOPIC print "Going to verify the number of cards displayed for the template INTRODUCE A TOPIC" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div/div/div" ))) cardsDisplayedIntroduceATopic = driver.find_elements_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div/div/div" ) actualNumberOfCardsIntroduceATopic = len(cardsDisplayedIntroduceATopic) cell2 = first_sheet.cell(45, 0) exNumberOfCardsIntroduceATopic = cell2.value if (actualNumberOfCardsIntroduceATopic == exNumberOfCardsIntroduceATopic): print "The cards count is displaying as expected" + " " + str( exNumberOfCardsIntroduceATopic) else: print "Failed to find the card count as expected" raise Exception # Going to verify the title card content print "Going to verify the title card content" cell3 = first_sheet.cell(45, 1) exTitleCardContentIntroduceATopic = cell3.value actualTitleCardContentIntroduceATopic = driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/h1/textarea" ).text if (exTitleCardContentIntroduceATopic == actualTitleCardContentIntroduceATopic): print "The title card label is displaying as expected" + " " + '"' + exTitleCardContentIntroduceATopic + '"' else: print "Failed to find the expected label in title card" raise Exception # Going to clear the Title present in the title card print "Going to clear the lesson title" driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/h1/textarea" ).clear() print "Entering the title for lesson" cell4 = first_sheet.cell(45, 2) titleIntroduceATopic = cell4.value 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(titleIntroduceATopic) print "Clicking on second card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div/div/div[2]/div/div[1]" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div/div/div[2]/div/div[1]" ).click() print "Going to verify the content in second card" 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/div[2]/div/div/div/div/div" ))) cell5 = first_sheet.cell(45, 3) exSecondCardContentIntroduceATopic1 = cell5.value actualSecondCardContentIntroduceATopic1 = 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[1]/div/span/span/span" ).text cell6 = first_sheet.cell(45, 4) exSecondCardContentIntroduceATopic2 = cell6.value actualSecondCardContentIntroduceATopic2 = 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[3]/div/span[1]/span/span" ).text cell7 = first_sheet.cell(45, 5) exSecondCardContentIntroduceATopic3 = cell7.value actualSecondCardContentIntroduceATopic3 = 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[3]/div/span[5]/span/span" ).text cell8 = first_sheet.cell(45, 6) exSecondCardContentIntroduceATopic4 = cell8.value actualSecondCardContentIntroduceATopic4 = 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[3]/div/span[7]/span[1]/span" ).text cell9 = first_sheet.cell(45, 7) exSecondCardContentIntroduceATopic5 = cell9.value actualSecondCardContentIntroduceATopic5 = 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[3]/div/span[7]/span[2]/span" ).text cell10 = first_sheet.cell(45, 8) exSecondCardContentIntroduceATopic6 = cell10.value actualSecondCardContentIntroduceATopic6 = 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[5]/div/span" ).text if (exSecondCardContentIntroduceATopic1 == actualSecondCardContentIntroduceATopic1): if (exSecondCardContentIntroduceATopic2 == actualSecondCardContentIntroduceATopic2): if (exSecondCardContentIntroduceATopic3 == actualSecondCardContentIntroduceATopic3): if (exSecondCardContentIntroduceATopic4 == actualSecondCardContentIntroduceATopic4): if (exSecondCardContentIntroduceATopic5 == actualSecondCardContentIntroduceATopic5): if (exSecondCardContentIntroduceATopic6 == actualSecondCardContentIntroduceATopic6): print "Successfully verified the content in second card" else: print "Failed to verify the content in second card" raise Exception print "Clicking on Third card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[3]/div/div[1]" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[3]/div/div[1]" ).click() print "Going to verify the contents in Third card" 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/div[2]/div/div/div/div/div" ))) cell11 = first_sheet.cell(46, 0) exThirdCardContentIntroduceATopic1 = cell11.value actualThirdCardContentIntroduceATopic1 = 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[1]/div/span/span/span" ).text cell12 = first_sheet.cell(46, 1) exThirdCardContentIntroduceATopic2 = cell12.value actualThirdCardContentIntroduceATopic2 = 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[3]/div/span/span[1]/span" ).text cell13 = first_sheet.cell(46, 2) exThirdCardContentIntroduceATopic3 = cell13.value actualThirdCardContentIntroduceATopic3 = 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[3]/div/span/span[2]/span" ).text cell14 = first_sheet.cell(46, 3) exThirdCardContentIntroduceATopic4 = cell14.value actualThirdCardContentIntroduceATopic4 = 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[3]/div/span/span[3]/span" ).text cell15 = first_sheet.cell(46, 4) exThirdCardContentIntroduceATopic5 = cell15.value actualThirdCardContentIntroduceATopic5 = 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[5]/div/span/span/span" ).text cell16 = first_sheet.cell(46, 5) exThirdCardContentIntroduceATopic6 = cell16.value actualThirdCardContentIntroduceATopic6 = 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[6]/div/span/span[1]/span" ).text cell17 = first_sheet.cell(46, 6) exThirdCardContentIntroduceATopic7 = cell17.value actualThirdCardContentIntroduceATopic7 = 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[6]/div/span/span[2]/span" ).text cell18 = first_sheet.cell(46, 7) exThirdCardContentIntroduceATopic8 = cell18.value actualThirdCardContentIntroduceATopic8 = 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[6]/div/span/span[3]/span" ).text if (exThirdCardContentIntroduceATopic1 == actualThirdCardContentIntroduceATopic1): if (exThirdCardContentIntroduceATopic2 == actualThirdCardContentIntroduceATopic2): if (exThirdCardContentIntroduceATopic3 == actualThirdCardContentIntroduceATopic3): if (exThirdCardContentIntroduceATopic4 == actualThirdCardContentIntroduceATopic4): if (exThirdCardContentIntroduceATopic5 == actualThirdCardContentIntroduceATopic5): if (exThirdCardContentIntroduceATopic6 == actualThirdCardContentIntroduceATopic6): if (exThirdCardContentIntroduceATopic7 == actualThirdCardContentIntroduceATopic7 ): if (exThirdCardContentIntroduceATopic8 == actualThirdCardContentIntroduceATopic8 ): print "Successfully verified the content in Third card" else: print "Failed to verify the content in Third card" raise Exception print "Clicking on Fourth card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[4]/div/div[1]" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[4]/div/div[1]" ).click() print "Going to verify the content in Fourth card" 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/div[2]/div/div/div/div/div" ))) cell19 = first_sheet.cell(47, 0) exFourthCardContentIntroduceATopic1 = cell19.value actualFourthCardContentIntroduceATopic1 = 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[1]/div/span/span/span" ).text cell20 = first_sheet.cell(47, 1) exFourthCardContentIntroduceATopic2 = cell20.value actualFourthCardContentIntroduceATopic2 = 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[2]/div/span/span/span" ).text if (exFourthCardContentIntroduceATopic1 == actualFourthCardContentIntroduceATopic1): if (exFourthCardContentIntroduceATopic2 == actualFourthCardContentIntroduceATopic2): print "Successfully verified the content in fourth card" else: print "Failed to verify the content in Fourth card" raise Exception print "Clicking on Fifth card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[5]/div/div[1]" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[5]/div/div[1]" ).click() print "Going to verify the content in Fifth card" 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/div[2]/div/div/div/div/div" ))) cell21 = first_sheet.cell(48, 0) exFifthCardContentIntroduceATopic1 = cell21.value actualFifthCardContentIntroduceATopic1 = 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[1]/div/span/span[1]/span" ).text cell22 = first_sheet.cell(48, 1) exFifthCardContentIntroduceATopic2 = cell22.value actualFifthCardContentIntroduceATopic2 = 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[1]/div/span/span[3]/span" ).text cell23 = first_sheet.cell(48, 2) exFifthCardContentIntroduceATopic3 = cell23.value actualFifthCardContentIntroduceATopic3 = 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[1]/div/span/span[4]/span" ).text cell24 = first_sheet.cell(48, 3) exFifthCardContentIntroduceATopic4 = cell24.value actualFifthCardContentIntroduceATopic4 = 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[1]/div/span/span[5]/span" ).text cell25 = first_sheet.cell(48, 4) exFifthCardContentIntroduceATopic5 = cell25.value actualFifthCardContentIntroduceATopic5 = 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[3]/div/span/span/span" ).text cell26 = first_sheet.cell(48, 5) exFifthCardContentIntroduceATopic6 = cell26.value actualFifthCardContentIntroduceATopic6 = 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[4]/div/span/span/span" ).text if (exFifthCardContentIntroduceATopic1 == actualFifthCardContentIntroduceATopic1): if (exFifthCardContentIntroduceATopic2 == actualFifthCardContentIntroduceATopic2): if (exFifthCardContentIntroduceATopic3 == actualFifthCardContentIntroduceATopic3): if (exFifthCardContentIntroduceATopic4 == actualFifthCardContentIntroduceATopic4): if (exFifthCardContentIntroduceATopic5 == actualFifthCardContentIntroduceATopic5): if (exFifthCardContentIntroduceATopic6 == actualFifthCardContentIntroduceATopic6): print "Successfully verified the content in Fifth card" else: print "Failed to verify the content in Fifth card" raise Exception print "Clicking on Sixth card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[6]/div/div[1]" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[6]/div/div[1]" ).click() print "Going to verify the content in Sixth card" 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/div[2]/div/div/div/div/div" ))) cell27 = first_sheet.cell(49, 0) exSixthCardContentIntroduceATopic1 = cell27.value actualSixthCardContentIntroduceATopic1 = 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[1]/div/span/span/span" ).text cell28 = first_sheet.cell(49, 1) exSixthCardContentIntroduceATopic2 = cell28.value actualSixthCardContentIntroduceATopic2 = 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[3]/div/span/span[1]/span" ).text cell29 = first_sheet.cell(49, 2) exSixthCardContentIntroduceATopic3 = cell29.value actualSixthCardContentIntroduceATopic3 = 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[3]/div/span/span[2]/span" ).text cell30 = first_sheet.cell(49, 3) exSixthCardContentIntroduceATopic4 = cell30.value actualSixthCardContentIntroduceATopic4 = 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[3]/div/span/span[3]/span" ).text if (exSixthCardContentIntroduceATopic1 in actualSixthCardContentIntroduceATopic1): if (exSixthCardContentIntroduceATopic2 == actualSixthCardContentIntroduceATopic2): if (exSixthCardContentIntroduceATopic3 == actualSixthCardContentIntroduceATopic3): if (exSixthCardContentIntroduceATopic4 == actualSixthCardContentIntroduceATopic4): print "Successfully verified the content in Sixth card" else: print "Failed to verify the content in Sixth card" raise Exception print "Clicking on Seventh card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[7]/div/div[1]" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[7]/div/div[1]" ).click() print "Going to verify the content in Seventh card" 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/div[2]/div/div/div/div/div" ))) cell31 = first_sheet.cell(50, 0) exSeventhCardContentIntroduceATopic1 = cell31.value actualSeventhCardContentIntroduceATopic1 = 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[1]/div/span/span/span" ).text cell32 = first_sheet.cell(50, 1) exSeventhCardContentIntroduceATopic2 = cell32.value actualSeventhCardContentIntroduceATopic2 = 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[2]/div/span/span/span" ).text if (exSeventhCardContentIntroduceATopic1 == actualSeventhCardContentIntroduceATopic1): if (exSeventhCardContentIntroduceATopic2 == actualSeventhCardContentIntroduceATopic2): print "Successfully verified the Seventh card content" else: print "Failed to verify Seventh card content" raise Exception print "Clicking on Eight th card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[8]/div/div[1]" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[8]/div/div[1]" ).click() print "Going to verify the content in Eight th card" 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/div[2]/div/div/div/div/div" ))) cell33 = first_sheet.cell(51, 0) exEightthCardContentIntroduceATopic1 = cell33.value actualEightthCardContentIntroduceATopic1 = 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[1]/div/span/span[1]/span" ).text cell34 = first_sheet.cell(51, 1) exEightthCardContentIntroduceATopic2 = cell34.value actualEightthCardContentIntroduceATopic2 = 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[1]/div/span/span[2]/span" ).text cell35 = first_sheet.cell(51, 2) exEightthCardContentIntroduceATopic3 = cell35.value actualEightthCardContentIntroduceATopic3 = 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[1]/div/span/span[3]/span" ).text cell36 = first_sheet.cell(51, 3) exEightthCardContentIntroduceATopic4 = cell36.value actualEightthCardContentIntroduceATopic4 = 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[3]/div/span/span/span" ).text cell37 = first_sheet.cell(51, 4) exEightthCardContentIntroduceATopic5 = cell37.value actualEightthCardContentIntroduceATopic5 = 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[4]/div/span/span/span" ).text if (exEightthCardContentIntroduceATopic1 == actualEightthCardContentIntroduceATopic1): if (exEightthCardContentIntroduceATopic2 == actualEightthCardContentIntroduceATopic2): if (exEightthCardContentIntroduceATopic3 == actualEightthCardContentIntroduceATopic3): if (exEightthCardContentIntroduceATopic4 == actualEightthCardContentIntroduceATopic4): if (exEightthCardContentIntroduceATopic5 == actualEightthCardContentIntroduceATopic5): print "Successfully verified the content in Eight th card" else: print "Failed to verify the content in Eight th card" raise Exception print "Clicking on Nineth card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[9]/div/div[1]" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[9]/div/div[1]" ).click() print "Going to verify the content in Nineth card" 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/div[2]/div/div/div/div/div" ))) cell38 = first_sheet.cell(52, 0) exNinethCardContentIntroduceATopic1 = cell38.value actualNinethCardContentIntroduceATopic1 = 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[1]/div/span/span/span" ).text cell39 = first_sheet.cell(52, 1) exNinethCardContentIntroduceATopic2 = cell39.value actualNinethCardContentIntroduceATopic2 = 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[2]/div/span/span/span" ).text if (exNinethCardContentIntroduceATopic1 == actualNinethCardContentIntroduceATopic1): if (exNinethCardContentIntroduceATopic2 == actualNinethCardContentIntroduceATopic2): print "Successfully verified the content in Nine th card" else: print "Failed to verify the content in Nine th card" raise Exception print "Clicking on Ten th card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[10]/div/div[1]" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[10]/div/div[1]" ).click() print "Going to verify the content in Ten th card" 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/div[2]/div/div/div/div/div" ))) cell40 = first_sheet.cell(53, 0) exTenthCardContentIntroduceATopic1 = cell40.value actualTenthCardContentIntroduceATopic1 = 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[1]/div/span/span[1]/span" ).text cell41 = first_sheet.cell(53, 1) exTenthCardContentIntroduceATopic2 = cell41.value actualTenthCardContentIntroduceATopic2 = 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[1]/div/span/span[2]/span" ).text cell42 = first_sheet.cell(53, 2) exTenthCardContentIntroduceATopic3 = cell42.value actualTenthCardContentIntroduceATopic3 = 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[3]/div/span" ).text cell43 = first_sheet.cell(53, 2) exTenthCardContentIntroduceATopic4 = cell43.value actualTenthCardContentIntroduceATopic4 = 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[4]/div/span/span/span" ).text if (exTenthCardContentIntroduceATopic1 == actualTenthCardContentIntroduceATopic1): if (exTenthCardContentIntroduceATopic2 == actualTenthCardContentIntroduceATopic2): if (exTenthCardContentIntroduceATopic3 == actualTenthCardContentIntroduceATopic3): if (exTenthCardContentIntroduceATopic4 == actualTenthCardContentIntroduceATopic4): print "Successfully verified the content in Ten th card" else: print "Failed to verify the content in Ten th card" raise Exception print "Clicking on Eleven th card" wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[11]/div/div[1]" ))) driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[11]/div/div[1]" ).click() print "Going to verify the content in Eleventh card" 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/p/textarea" ))) cell44 = first_sheet.cell(54, 0) exEleventhCardIntroduceATopicContent1 = cell44.value cell45 = first_sheet.cell(54, 1) exEleventhCardIntroduceATopicContent2 = cell45.value cell46 = first_sheet.cell(54, 2) exEleventhCardIntroduceATopicContent3 = cell46.value actualEleventhCardIntroduceATopic1 = 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" ).get_attribute("placeholder") actualEleventhCardIntroduceATopic2 = driver.find_element_by_xpath( ".//*[@id='question-answer-input-0']").get_attribute("placeholder") actualEleventhCardIntroduceATopic3 = driver.find_element_by_xpath( ".//*[@id='question-answer-input-1']").get_attribute("placeholder") plusIconLocatorIntroduceATopic = 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[3]/div/div[1]/div/span" ) if (exEleventhCardIntroduceATopicContent1 == actualEleventhCardIntroduceATopic1): if (exEleventhCardIntroduceATopicContent2 == actualEleventhCardIntroduceATopic2): if (exEleventhCardIntroduceATopicContent3 == actualEleventhCardIntroduceATopic3): if (plusIconLocatorIntroduceATopic.is_displayed()): print "The Eleventh card content is displaying as expected" else: print "Failed to find the expected content in Eleventh card" raise Exception wait.until( EC.visibility_of_element_located( (By.XPATH, ".//*[@id='question-answer-input-0']"))) print "Entering question" cell47 = first_sheet.cell(1, 2) questionCard = cell47.value 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" cell48 = first_sheet.cell(1, 3) ans1 = cell48.value driver.find_element_by_xpath( ".//*[@id='question-answer-input-0']").send_keys(ans1) print "Entering Second answer" cell49 = first_sheet.cell(1, 4) ans2 = cell49.value 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']")))
def publishLesson(self): print "Going to publish the lesson" 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 \"" + actual_titleof_scormlesson + "\""; 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[.='" + actual_titleof_scormlesson + "'])[1]"))) if driver.find_element_by_xpath("(//tbody/tr/td[2]/a[.='" + actual_titleof_scormlesson + "'])[1]").is_displayed(): print "Lesson is displayed in Grid ::" + actual_titleof_scormlesson 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 uploadscormAndPowerpoint(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 = 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 for Power Point icon wait.until( EC.visibility_of_element_located(( By.XPATH, "html/body/div[2]/div/div/div[2]/div[7]/div/div/div/span[2]"))) book = xlrd.open_workbook(os.path.join('TestData.xlsx')) first_sheet = book.sheet_by_name('MultiCardLesson') cell1 = first_sheet.cell(56, 0) ScormOrImageFilePath = cell1.value print "Going to upload the SCORM or POWER POINT file" driver.find_element_by_css_selector('input[type="file"]').send_keys( ScormOrImageFilePath) wait = WebDriverWait(driver, 600) wait.until( EC.visibility_of_element_located(( By.XPATH, ".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[1]/a" ))) print "Successfully uploaded the SCORM or POWER POINT file" print "Going to verify the title of Uploaded SCORM or POWER POINT file" global actual_titleof_scormlesson actual_titleof_scormlesson = driver.find_element_by_xpath( ".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/h1/textarea" ).text cell2 = first_sheet.cell(57, 0) expected_titleof_scormlesson = cell2.value if (expected_titleof_scormlesson == actual_titleof_scormlesson): print "Successfully verified the title of Uploaded Scorm or Powerpoint lesson" else: print "Failed to verify the title of Uploaded Scorm or Powerpoint lesson" raise Exception
def teachASkills(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() print "Going to verify the display of TEACH A SKILL Teamplate" book=xlrd.open_workbook(os.path.join('TestData.xlsx')) first_sheet = book.sheet_by_name('MultiCardLesson') cell1 = first_sheet.cell(32,0) exTemplateNameTeachASkill = cell1.value wait.until(EC.visibility_of_element_located((By.XPATH,"html/body/div[2]/div/div/div[2]/div[4]/div/div"))) teachAskillLocator = driver.find_element_by_xpath("html/body/div[2]/div/div/div[2]/div[4]/h4") if (teachAskillLocator.is_displayed() and teachAskillLocator.text == exTemplateNameTeachASkill): print "The TEACH A SKILL Template is displaying in Create a new lesson pop up" else: print "Failed to find the TEACH A SKILL Template in Create a new lesson pop up" raise Exception # Clicking on Teach a skill template print "Clicking on Teach A Skill template" driver.find_element_by_xpath("html/body/div[2]/div/div/div[2]/div[4]/div/div").click() # Going to verify the number of cards displayed for the template TEACH A SKILL print "Going to verify the number of cards displayed for the template TEACH A SKILL" wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[1]/div/div"))) cardsDisplayedTeachASkill=driver.find_elements_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[1]/div/div") actualNumberOfCardsTecahASkill = len(cardsDisplayedTeachASkill) cell2 = first_sheet.cell(33,0) exNumberOfCardsTeachASkill = cell2.value if(actualNumberOfCardsTecahASkill == exNumberOfCardsTeachASkill): print "The cards count is displaying as expected"+" "+str(exNumberOfCardsTeachASkill) else: print "Failed to find the card count as expected" raise Exception # Going to verify the title card content print "Going to verify the title card content" cell3 = first_sheet.cell(33,1) exTitleCardContentTeachASkill = cell3.value actualTitleCardContentTeachASkill = driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/h1/textarea").text if (exTitleCardContentTeachASkill == actualTitleCardContentTeachASkill): print "The title card label is displaying as expected"+" "+'"'+exTitleCardContentTeachASkill+'"' else: print "Failed to find the expected label in title card" raise Exception # Going to clear the Title present in the title card print "Going to clear the lesson title" driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/h1/textarea").clear() print "Entering the title for lesson" cell4= first_sheet.cell(33,2) titleTeachASkill = cell4.value 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(titleTeachASkill) # Clicking on Second card print "Clicking on Second card" driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[1]/div/div[2]/div/div[1]").click() # Going to verify the content in second card print "Going to verify the content in second card" 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/div[2]/div/div/div/div/div"))) cell5= first_sheet.cell(33,3) exSecondCardTeachASkill1 = cell5.value cell6= first_sheet.cell(33,4) exSecondCardTeachASkill2 = cell6.value cell7= first_sheet.cell(33,5) exSecondCardTeachASkill3 = cell7.value cell8= first_sheet.cell(33,6) exSecondCardTeachASkill4 = cell8.value cell9= first_sheet.cell(33,7) exSecondCardTeachASkill5 = cell9.value cell10= first_sheet.cell(33,8) exSecondCardTeachASkill6 = cell10.value actualSecondCardTeachASkill1 = 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[1]/div/span/span/span").text actualSecondCardTeachASkill2 = 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[3]/div/span[1]/span/span").text actualSecondCardTeachASkill3 = 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[3]/div/span[2]/span[1]/span").text actualSecondCardTeachASkill4 = 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[3]/div/span[2]/span[2]/span").text actualSecondCardTeachASkill5 = 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[3]/div/span[2]/span[3]/span").text actualSecondCardTeachASkill6 = 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[5]/div/span/span/span").text if(exSecondCardTeachASkill1 == actualSecondCardTeachASkill1): if(exSecondCardTeachASkill2 == actualSecondCardTeachASkill2): if(exSecondCardTeachASkill3 == actualSecondCardTeachASkill3): if(exSecondCardTeachASkill4 == actualSecondCardTeachASkill4): if(exSecondCardTeachASkill5 == actualSecondCardTeachASkill5): if(exSecondCardTeachASkill6 == actualSecondCardTeachASkill6): print "The second card content is displaying as expected" else: print "Failed to find the expected content in second card" raise Exception # Clicking on > icon print "Clicking on > arrow for Third card" wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div"))) driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div").click() # Clicking on Third card print "Clicking on Third card" wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[3]/div/div[1]"))) driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[3]/div/div[1]").click() # Going to verify the content in Third card 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/div[2]/div/div/div/div/div"))) print "Going to verify the content in Third card" cell11 = first_sheet.cell(34,0) exThirdCardTeachASkill1 = cell11.value actualThirdCardTeachASkill1 = 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[1]/div/span/span/span").text cell12 = first_sheet.cell(34,1) exThirdCardTeachASkill2 = cell12.value actualThirdCardTeachASkill2 = 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[2]/div/span/span/span").text if(exThirdCardTeachASkill1 == actualThirdCardTeachASkill1): if(exThirdCardTeachASkill2 == actualThirdCardTeachASkill2): print "The third card content is displaying as expected" else: print "Failed to find the expected content in third card" raise Exception # Clicking on < icon print "Clicking on < arrow for Fourth card" wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[1]"))) driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[1]").click() # Clicking on Fourth card print "Clicking on Fourth card" wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[1]/div/div[4]/div/div[1]"))) driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[1]/div/div[4]/div/div[1]").click() # Going to verify the content in Fourth card card print "Going to verify the content in Fourth card" cell13 = first_sheet.cell(35,0) exFourthCardTeachASkill1 = cell13.value actualFourthCardTeachASkill1 = 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[1]/span").text cell14 = first_sheet.cell(35,1) exFourthCardTeachASkill2 = cell14.value actualFourthCardTeachASkill2 = 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[2]/span").text cell15 = first_sheet.cell(35,2) exFourthCardTeachASkill3 = cell15.value actualFourthCardTeachASkill3 = 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[3]/span").text if(exFourthCardTeachASkill1 == actualFourthCardTeachASkill1): if(exFourthCardTeachASkill2 == actualFourthCardTeachASkill2): if(exFourthCardTeachASkill3 == actualFourthCardTeachASkill3): print "The fourth card content is displaying as expected" else: print "Failed to find the expected content in fourth card" raise Exception # Going to click on Fifth card print "Clicking on Fifth card" wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[5]/div/div[1]"))) driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[5]/div/div[1]").click() # Going to verify the content in fifth card print "Going to verify the content in Fifth card" 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/div[2]/div/div/div/div/div"))) cell16 = first_sheet.cell(36,0) exFifthCardTeachASkill1 = cell16.value actualFifthCardTeachASkill1 = 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[1]/div/span/span/span").text cell17 = first_sheet.cell(36,1) exFifthCardTeachASkill2 = cell17.value actualFifthCardTeachASkill2 = 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[2]/div/span/span/span").text if(exFifthCardTeachASkill1 == actualFifthCardTeachASkill1): if(exFifthCardTeachASkill2 == actualFifthCardTeachASkill2): print "The Fifth card content is displaying as expected" else: print "Failed to find the expected content in Fifth card" raise Exception # Going to click on Sixth card print "Clicking on Sixth card" wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[6]/div/div[1]"))) driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[6]/div/div[1]").click() # Verifying Sixth card labels print "Going to verify the content in Sixth card" 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"))) cell18 = first_sheet.cell(37,0) exSixthCardTeachASkill1 = cell18.value actualSixthCardTeachASkill1 = 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[1]/span").text cell19 = first_sheet.cell(37,1) exSixthCardTeachASkill2 = cell19.value actualSixthCardTeachASkill2 = 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[2]/span").text cell20 = first_sheet.cell(37,2) exSixthCardTeachASkill3 = cell20.value actualSixthCardTeachASkill3 = 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[3]/span").text if(exSixthCardTeachASkill1 == actualSixthCardTeachASkill1): if(exSixthCardTeachASkill2 == actualSixthCardTeachASkill2): if(exSixthCardTeachASkill3 == actualSixthCardTeachASkill3): print "The Sixth card content is displaying as expected" else: print "Failed to find the expected content in Sixth card" raise Exception # Going to click on Seventh card print "Clicking on Seventh card" wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[7]/div/div[1]"))) driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[7]/div/div[1]").click() # Verifying the content in Seventh card 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/div[2]/div/div/div/div"))) cell21 = first_sheet.cell(38,0) exSeventhCardTeachASkill1 = cell21.value actualSeventhCardTeachASkill1 = 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[1]/div/span/span/span").text cell22 = first_sheet.cell(38,1) exSeventhCardTeachASkill2 = cell22.value actualSeventhCardTeachASkill2 = 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[2]/div/span/span/span").text if(exSeventhCardTeachASkill1 == actualSeventhCardTeachASkill1): if(exSeventhCardTeachASkill2 == actualSeventhCardTeachASkill2): print "The Seventh card content is displaying as expected" else: print "Failed to find the expected content in Seventh card" raise Exception print "Clicking on Eightth card" wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[8]/div/div[1]"))) driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[8]/div/div[1]").click() # Going to verify the content in Eightth card print "Going to verify the content in Eightth card" 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[2]/div/div/div[2]/div/div/div/div"))) 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[1]/div/div/div/div/div[2]/button"))) cell23 = first_sheet.cell(39,0) exEightthCardTeachASkill1 = cell23.value actualEightthCardTeachASkill1 = driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div[2]/div/div/div[2]/div/div/div/div/div[1]/div/span/span/span").text cell24 = first_sheet.cell(39,1) exEightthCardTeachASkill2 = cell24.value actualEightthCardTeachASkill2 = driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div[2]/div/div/div[2]/div/div/div/div/div[3]/div/span/span[1]/span").text cell25 = first_sheet.cell(39,2) exEightthCardTeachASkill3 = cell25.value actualEightthCardTeachASkill3 = driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div[2]/div/div/div[2]/div/div/div/div/div[3]/div/span/span[2]/span").text deleteButtonEightthCard = driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div[1]/div/div/div/div/div[2]/button") actualchangeLabelEightCard = driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div[1]/div/div/div/div/div[2]/div/label").text cell26 = first_sheet.cell(39,3) exchangeLabelEightCard = cell26.value if(exEightthCardTeachASkill1 == actualEightthCardTeachASkill1): if(exEightthCardTeachASkill2 == actualEightthCardTeachASkill2): if(exEightthCardTeachASkill3 == actualEightthCardTeachASkill3): if (deleteButtonEightthCard.is_displayed()): if (actualchangeLabelEightCard == exchangeLabelEightCard): print "The Eightth card content is displaying as expected" else: print "Failed to find the expected content in Eightth card" raise Exception # Clicking on Nineth card print "Clicking on Nineth card" driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[9]/div/div[1]").click() # Going to verify the content in Nineth card print "Going to verify the content in Nineth card" 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[2]/div/div/div[2]/div/div/div/div/div"))) cell27 = first_sheet.cell(40,0) exNinethCardTeachASkill1= cell27.value actualNinethCardTeachASkill1 = driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div[2]/div/div/div[2]/div/div/div/div/div[1]/div/span/span/span").text cell28 = first_sheet.cell(40,1) exNinethCardTeachASkill2= cell28.value actualNinethCardTeachASkill2 = driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div[2]/div/div/div[2]/div/div/div/div/div[3]/div/span/span/span").text cell29 = first_sheet.cell(40,2) exNinethCardTeachASkill3= cell29.value actualNinethCardTeachASkill3 = driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div[2]/div/div/div[2]/div/div/div/div/div[5]/div/span/span/span").text deleteButtonNinethCard = driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div[1]/div/div/div/div/div[2]/button") actualchangeLabelNinethCard = driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[1]/div/div[2]/div[2]/div/div/div/div/div[1]/div/div/div/div/div[2]/div/label").text cell30 = first_sheet.cell(40,3) exchangeLabelNinethCard= cell30.value if(exNinethCardTeachASkill1 == actualNinethCardTeachASkill1): if(exNinethCardTeachASkill2 == actualNinethCardTeachASkill2): if(exNinethCardTeachASkill3 == actualNinethCardTeachASkill3): if (deleteButtonNinethCard.is_displayed()): if (actualchangeLabelNinethCard == exchangeLabelNinethCard): print "The Nineth card content is displaying as expected" else: print "Failed to find the expected content in Nineth card" raise Exception # Clicking on Ten th card print "Clicking on Ten th card " driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[10]/div/div[1]").click() 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']"))) # Going to verify the content in Ten th card print "Going to verify the content in Tenth card" 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/p/textarea"))) cell31= first_sheet.cell(41,0) exTenthCardTeachASkillContent1 = cell31.value cell32= first_sheet.cell(41,1) exTenthCardTeachASkillContent2 = cell32.value cell33= first_sheet.cell(41,2) exTenthCardTeachASkillContent3 = cell33.value actualTenthCardTeachASkill1 = 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").get_attribute("placeholder") actualTenthCardTeachASkill2 = driver.find_element_by_xpath(".//*[@id='question-answer-input-0']").get_attribute("placeholder") actualTenthCardTeachASkill3= driver.find_element_by_xpath(".//*[@id='question-answer-input-1']").get_attribute("placeholder") plusIconLocatorTeachASkill = 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[3]/div/div[1]/div/span") if(exTenthCardTeachASkillContent1 == actualTenthCardTeachASkill1): if(exTenthCardTeachASkillContent2 == actualTenthCardTeachASkill2): if(exTenthCardTeachASkillContent3 == actualTenthCardTeachASkill3): if(plusIconLocatorTeachASkill.is_displayed()): print "The Tenth card content is displaying as expected" else: print "Failed to find the expected content in Tenth card" raise Exception wait.until(EC.visibility_of_element_located((By.XPATH,".//*[@id='question-answer-input-0']"))) print "Entering question" cell34= first_sheet.cell(1,2) questionCard = cell34.value 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" cell35= first_sheet.cell(1,3) ans1 = cell35.value driver.find_element_by_xpath(".//*[@id='question-answer-input-0']").send_keys(ans1) print "Entering Second answer" cell36= first_sheet.cell(1,4) ans2 = cell36.value 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']"))) # Clicking on Eleventh th card print "Clicking on Eleventh card " driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[11]/div/div[1]").click() print "Going to verify the content in Eleventh card" 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/div[2]/div/div/div/div/div"))) cell37= first_sheet.cell(42,0) exEleventhCardTeachASkillContent1 = cell37.value actualEleventhCardTeachASkillContent1 = 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[1]/div/span/span/span").text cell38= first_sheet.cell(42,1) exEleventhCardTeachASkillContent2 = cell38.value actualEleventhCardTeachASkillContent2 = 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[2]/div/span/span/span").text if(exEleventhCardTeachASkillContent1 == actualEleventhCardTeachASkillContent1): if(exEleventhCardTeachASkillContent2 == actualEleventhCardTeachASkillContent2): print "The Eleventh card content is displaying as expected" else: print "Failed to find the expected content in Eleventh card" raise Exception # Clicking on Twelve th card print "Clicking on Twelve th card " driver.find_element_by_xpath(".//*[@id='content']/div/div/div[3]/div[3]/div[2]/div[1]/div/div[2]/div/div[12]/div/div[1]").click() print "Going to verify the content in Twelve th card" 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/div[2]/div/div/div/div/div"))) cell39= first_sheet.cell(43,0) exTwelvethCardTeachASkillContent1 = cell39.value actualTwelvethCardTeachASkillContent1 = 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[1]/div/span/span[1]/span").text cell40= first_sheet.cell(43,1) exTwelvethCardTeachASkillContent2= cell40.value actualTwelvethCardTeachASkillContent2 = 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[1]/div/span/span[2]/span").text cell41= first_sheet.cell(43,2) exTwelvethCardTeachASkillContent3 = cell41.value actualTwelevethCardTeachASkillContent3 = 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[1]/div/span/span[3]/span").text cell42= first_sheet.cell(43,3) exEleventhCardTeachASkillContent4 = cell42.value actualEleventhCardTeachASkillContent4 = 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[3]/div/span/span/span").text cell43= first_sheet.cell(43,4) exEleventhCardTeachASkillContent5 = cell43.value actualEleventhCardTeachASkillContent5 = 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[4]/div/span/span/span").text if(exTwelvethCardTeachASkillContent1 == actualTwelvethCardTeachASkillContent1): if(exTwelvethCardTeachASkillContent2 == actualTwelvethCardTeachASkillContent2): if(exTwelvethCardTeachASkillContent3 == actualTwelevethCardTeachASkillContent3): if(exEleventhCardTeachASkillContent4 == actualEleventhCardTeachASkillContent4): if(exEleventhCardTeachASkillContent5 == actualEleventhCardTeachASkillContent5): print "The Twelve th card content is displaying as expected" else: print "Failed to find the expected content in Twelveth card" raise Exception