def clickLonger(self,locator): finder = ElemFinder() element = finder.findElement(locator) if element!=None: ElemFinder().runJs('window.scrollTo(0,'+element.location+')') element.click() time.sleep(3)
def isElementPresent(self,locator): finder = ElemFinder() try: element = finder.findElement(locator) except: logging.info('e.getMessage') if element!=None: return True else: return False
def rightClickMouse(self,locator): finder = ElemFinder() element = finder.findElement(locator) ActionChains(self.driver).context_click(element).perform() #********************************************************************************** # def selectByValue(self,locator,value): # WebDriverEngine().getSelect(locator) # time.sleep(5) # def selectByVisibleText(self,locator,value): # WebDriverEngine().getSelect(locator) # def selectByIndex(self,locator,index): # WebDriverEngine().getSelect(locator)
def type(self, locator, value): finder = ElemFinder() element = finder.findElement(locator) if element != None: element.send_keys(value)
def selectByIndex(self,locator,index): finder = ElemFinder() # select(finder.findElement(locator)).select_by_index(index) finder.findElement(locator).select_by_index(index) time.sleep(5)
def selectByVisibleText(self,locator,value): finder = ElemFinder() select(finder.findElement(locator)).select_by_visible_text(value) time.sleep(5)
def selectByValue(self,locator,value): finder=ElemFinder() select(finder.findElement(locator)).select_by_value(value) time.sleep(5)
def getSelect(self,locator): finder = ElemFinder() inputSelect=select().select(finder.findElement(locator)) # inputSelect=select(finder.findElement(locator)) return inputSelect
def getValue(self,locator): finder = ElemFinder() return finder.findElement(locator).get_attribute('value')
def getText(self,locator): finder = ElemFinder() return finder.findElement(locator).text.strip()
def isDisplayed(self,locator): finder = ElemFinder() element = finder.findElement(locator) if element!=None: print(element.is_displayed())
def doubleClick(self,locator): finder = ElemFinder() element = finder.findElement(locator)
def ischecked(self,locator): finder = ElemFinder() element = finder.findElement(locator) return element.is_selected()
def click(self, locator): finder = ElemFinder() element = finder.findElement(locator) if element != None: element.click() time.sleep(3)