Exemple #1
0
def selectCountry(country_name):
    se2lib = BuiltIn().get_library_instance("Selenium2Library")
    driver = se2lib._current_browser()
    number_tries = 0
    selected = False
    while (number_tries <= 5):
        number_tries += 1
        if iselementClick(driver,
                          locator="//span[@role='combobox']",
                          locatorType="xpath"):
            countries_list = getChildren(driver,
                                         "select2-results__options",
                                         "li",
                                         parentlocatorType="class")
            if len(countries_list) > 1:
                for i in range(len(countries_list)):
                    if countries_list[i].text == country_name:
                        index = i
                        break
                if iselementClick(driver, element=countries_list[index]):
                    BuiltIn().log(country_name + " is selected successfully")
                    selected = True
                    break
                else:
                    continue
            else:
                continue

        else:
            continue
    if selected == False:
        BuiltIn().log("Unable to select country " + country_name,
                      level="error")
    assert selected == True
def verifyIndestries(driver, liste):
    number_tries_indestries = 0
    indestries_found = False
    while (number_tries_indestries < 5):
        number_tries_indestries += 1
        if iselementClick(driver, element=liste[1]):
            BuiltIn().log("element is clicked")
            indestries_list = getChildren(driver,
                                          "select2-results__options",
                                          "li",
                                          parentlocatorType="class")
            if len(indestries_list) > 0:
                BuiltIn().log(
                    str(len(indestries_list)) +
                    " indestries found in this sector")
                indestries_found = True
                break
            else:
                continue
        else:
            BuiltIn().log("Unable to clcik element")
            continue
    if indestries_found == False:
        BuiltIn().log("No indestries found in this sector", level="error")
    return indestries_found
def selectSector(driver, sectors_list, sector_index):
    sector_name = sectors_list[sector_index].text
    number_tries_sectors = 0
    sector_clicked = False
    while (number_tries_sectors < 3):
        number_tries_sectors += 1
        if iselementClick(driver, element=sectors_list[sector_index]):
            sector_clicked = True
            break
        else:
            continue
    if sector_clicked:
        BuiltIn().log("Sector " + sector_name + " is clicked successfully")
    else:
        BuiltIn().log("Unable to click sector " + sector_name)
    return sector_clicked
def clickSectorInputField(driver, liste):
    number_tries = 0
    while (number_tries <= 5):
        number_tries += 1
        if iselementClick(driver, element=liste[0]):
            sectors_list = getChildren(driver,
                                       "select2-results__options",
                                       "li",
                                       parentlocatorType="class")
            if len(sectors_list) > 0:
                break
            else:
                continue
        else:
            continue
    return sectors_list
Exemple #5
0
def clickAddToPortfolioBtn(locator):
    se2lib = BuiltIn().get_library_instance("Selenium2Library")
    driver = se2lib._current_browser()
    btn_locator = getLocator(locator)
    btn_locatorType = getLocatorType(locator)
    number_tries = 0
    clicked = False
    while (number_tries < 5):
        number_tries += 1
        if iselementClick(driver,
                          locator=btn_locator,
                          locatorType=btn_locatorType):
            clicked = True
            break
    if clicked:
        BuiltIn().log("Add to portfolio btn is clicked successfully")
    else:
        BuiltIn().log("Unable to click Add to portfolio btn", level="error")
    assert clicked == True
Exemple #6
0
def boxesVerification(box,question,popover):
    se2lib = BuiltIn().get_library_instance("Selenium2Library")
    driver = se2lib._current_browser()
    boxlocator=getLocator(box)
    boxlocatorType=getLocatorType(box)
    questionlocator=getLocator(question)
    questionlocatorType=getLocatorType(question)
    popoverlocator=getLocator(popover)
    popoverlocatorType=getLocatorType(popover)
    boxes_liste=getElementList(driver,boxlocator,boxlocatorType) 
    question_marks=getElementList(driver,questionlocator,questionlocatorType)      
    l=len(boxes_liste)
    if l!=6:
         BuiltIn().log("Boxes List contains uncertain number of elements==>"+str(l),level="error")
         assert False==True
    else:
        count=0
        j=0
        result=True
        for i in range(l-1):
            if (boxes_liste[i].text!="Fail") &  (boxes_liste[i].text!="Pass") & (boxes_liste[i].text!="Missing Data" ):
                BuiltIn().log("Text in box number "+str(i+1)+"is not accurate",level="error") 
                result= False
            elif boxes_liste[i].text=="Pass":
                count+=1
            elif boxes_liste[i].text=="Fail":
                if iselementClick(driver,element= question_marks[j]):
                    j+=1
                    if isElementPresent(driver,popoverlocator,popoverlocatorType)==False:
                         BuiltIn().log("Pop over in box number "+str(j+1)+"doesn't exist",level="error")
                         result= False
                else:
                     BuiltIn().log("Unable to click question mark number "+str(j+1),level="error")
                     result= False
    compliance_text=str(count)+"/5"
    if (boxes_liste[l-1].text == compliance_text) == False:
         BuiltIn().log("Compliance text is not acccurate",level="error")
         result= False
    if result:
        BuiltIn().log("Boxes verification is successful")
    else:
        BuiltIn().log("Boxes verification is unsuccessful",level="error")
        assert False==True