Package core.helpers.legacy
Class Helper
- java.lang.Object
-
- core.helpers.Helper
-
- core.helpers.legacy.Helper
-
public class Helper extends Helper
-
-
Field Summary
Fields Modifier and Type Field Description static ClickHelperclickstatic ClickHelperActionclickActionstatic ClickHelperJsclickJsstatic CsvHelpercsvstatic DateHelperdatestatic FormHelperformstatic ImageProcessingHelperimagestatic ListHelperliststatic Loginbuilderloginbuilderstatic MobileHelpermobilestatic PageHelperpagestatic VerifyHelperverifystatic WaitHelperwait-
Fields inherited from class core.helpers.Helper
reportPortal, webdriver
-
-
Constructor Summary
Constructors Constructor Description Helper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static StringacceptAlert()accepts alert by selecting ok or cancelstatic voidaddFileToZip(String path, String srcFile, ZipOutputStream zip)static voidappendToFile(String value, String absolutePath)appends to existing filestatic voidappendToFile(String value, String directory, String filename, String type)appends to existing filestatic voidassertContains(String expected, String actual)assert actual contains expectedstatic voidassertEquals(boolean expected, boolean actual)assert expected equals actualstatic voidassertEquals(int expected, int actual)assert expected equals actualstatic voidassertEquals(String expected, String actual)assert expected equals actualstatic voidassertFalse(String message)static voidassertTrue(String message, boolean value)assert truestatic voidbringPageToFront()brings current browser to frontstatic EnhancedBybyAccessibility(String element, String name)gets element by accessibility idstatic EnhancedBybyCss(String element, String name)gets element by css valuestatic EnhancedBybyId(String element, String name)gets element by idstatic EnhancedBybyXpath(String element, String name)gets element by xpathstatic voidcaptureExtentReportScreenshot()captures screenshot And attaches to extent test reportstatic voidclearAndSetField(EnhancedBy field, int index, CharSequence... value)sets field clears field before setting the valuestatic voidclearAndSetField(EnhancedBy field, CharSequence... value)sets field clears field before setting the valuestatic voidclearAndSetField(List<org.openqa.selenium.WebElement> field, int index, CharSequence... value)sets field clears field before setting the valuestatic voidclearAndSetField(org.openqa.selenium.WebElement field, CharSequence... value)sets field clears field before setting the valuestatic voidclick(org.openqa.selenium.WebElement target)static voidclickAndExpect(EnhancedBy target, int index, EnhancedBy expected)clicks element based on index And waits for expected element to be displayedstatic voidclickAndExpect(EnhancedBy target, int index, EnhancedBy expected1, EnhancedBy expected2)clicks target And wait for one the 2 expected elements to appearstatic voidclickAndExpect(EnhancedBy target, EnhancedBy expected)clicks target And waits for expected element to display retries 10 timesstatic voidclickAndExpect(EnhancedBy target, EnhancedBy expected, boolean isMobileRefresh)clicks target And waits for expected element to display retries 10 timesstatic voidclickAndExpect(EnhancedBy target, EnhancedBy expected, EnhancedBy spinner)clicks target And waits for expected element to show up also waits for spinner element to be removed from displaystatic voidclickAndExpect(EnhancedBy target, String text, EnhancedBy expected)click And expect based on the text value on the element.static voidclickAndExpect(List<org.openqa.selenium.WebElement> target, int index, org.openqa.selenium.WebElement expected)clicks element based on index And waits for expected element to be displayedstatic voidclickAndExpect(List<org.openqa.selenium.WebElement> target, int index, org.openqa.selenium.WebElement expected1, org.openqa.selenium.WebElement expected2)clicks target And wait for one the 2 expected elements to appearstatic voidclickAndExpect(List<org.openqa.selenium.WebElement> target, String text, org.openqa.selenium.WebElement expected)click And expect based on the text value on the element.static voidclickAndExpect(org.openqa.selenium.WebElement target, org.openqa.selenium.WebElement expected)clicks target And waits for expected element to display retries 10 timesstatic voidclickAndExpect(org.openqa.selenium.WebElement target, org.openqa.selenium.WebElement expected, boolean isMobileRefresh)clicks target And waits for expected element to display retries 10 timesstatic voidclickAndExpect(org.openqa.selenium.WebElement target, org.openqa.selenium.WebElement expected, org.openqa.selenium.WebElement spinner)clicks target And waits for expected element to show up also waits for spinner element to be removed from displayvoidclickAndExpectContainsByText(EnhancedBy target, String text, EnhancedBy expected)click And expect based on the text value on the element.voidclickAndExpectContainsByText(List<org.openqa.selenium.WebElement> target, String text, org.openqa.selenium.WebElement expected)click And expect based on the text value on the element.static voidclickAndHold(EnhancedBy target, double seconds)click And hold elementstatic voidclickAndHold(EnhancedBy target, int index, double seconds)click And hold based on element indexstatic voidclickAndHold(List<org.openqa.selenium.WebElement> target, int index, double seconds)click And hold based on element indexstatic voidclickAndHold(org.openqa.selenium.WebElement target, double seconds)click And hold elementstatic voidclickAndNotExpect(EnhancedBy target, int index, EnhancedBy expected)static voidclickAndNotExpect(EnhancedBy target, EnhancedBy expected)clicks target And waits for expected to not be displayed retries 10 timesstatic voidclickAndNotExpect(org.openqa.selenium.WebElement target, int index, org.openqa.selenium.WebElement expected)static voidclickAndNotExpect(org.openqa.selenium.WebElement target, org.openqa.selenium.WebElement expected)clicks target And waits for expected to not be displayed retries 10 timesstatic voidclickAndWait(EnhancedBy target, double timeInSeconds)clicks target And waits for secondsstatic voidclickAndWait(EnhancedBy target, int index, double timeInSeconds)clicks target And waits for secondsstatic voidclickAndWait(org.openqa.selenium.WebElement target, double timeInSeconds)clicks target And waits for secondsstatic voidclickAndWait(org.openqa.selenium.WebElement target, int index, double timeInSeconds)clicks target And waits for secondsstatic voidclickElementContinsByText(EnhancedBy by, String text)click element with text containingstatic voidclickElementContinsByText(org.openqa.selenium.WebElement target, String text)click element with text containingstatic voidclickElementLocationBy(EnhancedBy by, int x, int y)Click on an element's specific x,y locationstatic voidclickElementLocationBy(org.openqa.selenium.WebElement target, int x, int y)Click on an element's specific x,y locationstatic voidclickPoints(int x, int y)click at position x, ystatic voidclickPointsAndExpect(int x, int y, EnhancedBy expected)click point at x,y coordinates and expect and element to be present retry every 5 seconds for duration of explicit timeoutstatic voidclickPointsAndExpect(int x, int y, org.openqa.selenium.WebElement expected)click point at x,y coordinates and expect and element to be present retry every 5 seconds for duration of explicit timeoutstatic voidCloseAndReturn(String defaultWindow)close the window And return to the defaultWindowstatic StringconvertListToString(ArrayList<String> list)convert array list to string separated by ","static StringconvertListToString(ArrayList<String> list, String separator)convert array list to string separated by ","static URLconvertToUrl(String url)converts url string to url objectstatic voidcopyDirectory(String dirFrom, String dirTo)Copies directory And all content from dirFrom to dirTo overwrites the contentstatic FilecreateFileFromPath(String absolutePath)create directories and files based on absolute pathstatic ZipOutputStreamcreateZip(String destZipFile)static StringcurrentWindow()return the current window handlestatic voiddeleteAllCookies()delete all cookiesstatic voiddeleteCookieNamed(String name)delete cookie namedstatic voiddeleteFile(String absolutePath)delete filestatic StringdimissAlert()dismisses alert by selecting ok or cancel return alert messagestatic voiddoubleClick(EnhancedBy target, int index)double click on elementstatic voiddoubleClick(org.openqa.selenium.WebElement target, int index)double click on elementstatic voiddoubleClickBy(EnhancedBy by)static voiddoubleClickBy(org.openqa.selenium.WebElement element)static voiddoubleClickPoints(int x, int y)double click at positionstatic voiddragAndDrop(EnhancedBy src, int xOffset, int yOffset)drag And drop from src element to target elementvoiddragAndDrop(EnhancedBy srcParent, int srcParentIndex, EnhancedBy srcChild, int scrChildIndex, EnhancedBy targetParent, int targeParenttIndex, EnhancedBy targetChild, int targetChildIndex)drag And drop from src element to target elementstatic voiddragAndDrop(EnhancedBy src, EnhancedBy target)drag And drop from src element to target elementvoiddragAndDrop(List<org.openqa.selenium.WebElement> srcParent, int srcParentIndex, List<org.openqa.selenium.WebElement> srcChild, int scrChildIndex, List<org.openqa.selenium.WebElement> targetParent, int targeParenttIndex, List<org.openqa.selenium.WebElement> targetChild, int targetChildIndex)drag And drop from src element to target elementstatic voiddragAndDrop(org.openqa.selenium.WebElement src, int xOffset, int yOffset)drag And drop from src element to target elementstatic voiddragAndDrop(org.openqa.selenium.WebElement src, org.openqa.selenium.WebElement target)drag And drop from src element to target elementstatic Stringexcel_getCellData(ExcelObject excel)This method is to read the test data from the Excel cell, in this we are passing parameters as Row num And Col numstatic List<String>excel_getColumData(ExcelObject excel)returns all the column data as array list of stringstatic voidexcel_setCellData(ExcelObject excel)This method is to write in the Excel cell, Row num And Col num are the parametersstatic voidexcel_setCellData(List<ExcelObject> excelObjects)static ExcelObjectexcel_setExcelFile(ExcelObject excel)gets the excel file And the work sheetstatic ArrayList<String>executeCommand(String command)run command and return results as array list will run bash on linux or mac will run batch command on windowsstatic ArrayList<String>executeCommandFromFile(String filePath)run script file and return results as array list will run bash on linux or mac will run batch command on windowsstatic ObjectexecuteJs(String script, Object... args)execute javascriptstatic List<String>executeJsWithListReturn(String script, Object... args)execute javascriptstatic StringexecuteJsWithStringReturn(String script, Object... args)execute javascriptstatic int[]findElementCoordinates(EnhancedBy target)returns the center coordinates of the target elementstatic int[]findElementCoordinates(org.openqa.selenium.WebElement target)returns the center coordinates of the target elementprotected static EnhancedWebElementfindElements(org.openqa.selenium.WebElement element)finds list of elementsprotected static EnhancedWebElementfindElements(org.openqa.selenium.WebElement parent, int parentIndex, org.openqa.selenium.WebElement child)finds a list of elements based on parent elementprotected static EnhancedWebElementfindElements(org.openqa.selenium.WebElement parent, org.openqa.selenium.WebElement child)finds element based on parent elementstatic int[]findMiddleOfElement(EnhancedBy target)returns the center coordinates of the target elementstatic int[]findMiddleOfElement(org.openqa.selenium.WebElement target)returns the center coordinates of the target elementstatic voidformSubmit(EnhancedBy button, EnhancedBy expected)select submit button And wait for expected element to loadstatic voidformSubmit(EnhancedBy button, EnhancedBy expected, EnhancedBy spinner)clicks submit button, wait for element to appear And loading spinner to be removedstatic voidformSubmit(org.openqa.selenium.WebElement button, org.openqa.selenium.WebElement expected)select submit button And wait for expected element to loadstatic voidformSubmit(org.openqa.selenium.WebElement button, org.openqa.selenium.WebElement expected, org.openqa.selenium.WebElement spinner)clicks submit button, wait for element to appear And loading spinner to be removedstatic StringgenerateRandomInteger(int len)generates random int of length lenstatic intgenerateRandomNumber(int min, int max)generates random number between two numbers, min, maxstatic StringgenerateRandomString(int len)generates random string of length lenstatic StringgenerateUUID()generate uuidstatic StringgenerateUUID(boolean includeDash)generate uuidstatic StringgenerateUUID(int length)generate uuidstatic StringgenerateUUID(int length, boolean includeDash)generate uuidstatic StringgetAlertValue()returns alert message valuestatic List<String>getAllValuesStartringWith(String source, String value)gets a list of string from 'source' starting with 'value'static io.appium.java_client.android.AndroidDrivergetAndroidDriver()static StringgetAttribute(EnhancedBy byValue, int index, String attribute)gets specified attribute of the element based on indexstatic StringgetAttribute(EnhancedBy byValue, String attribute)gets specified attribute of the elementstatic StringgetAttribute(List<org.openqa.selenium.WebElement> elements, int index, String attribute)gets specified attribute of the element based on indexstatic StringgetAttribute(org.openqa.selenium.WebElement byValue, String attribute)gets specified attribute of the elementstatic StringgetClipboardData()retrieves the clip board datastatic StringgetCurrentUrl()returns the current urlstatic doublegetDoubleFromString(String value)get int value from stringstatic doublegetDoubleFromString(String value, boolean isFailOnNoInt)get numeric value from stringstatic intgetElementIndexContainByText(EnhancedBy listValue, String option)retuns index of element in list which contains in textstatic intgetElementIndexContainByText(List<org.openqa.selenium.WebElement> listValue, String option)retuns index of element in list which contains in textstatic intgetElementIndexEqualsByText(EnhancedBy listValue, String option)returns the index of text value in a liststatic intgetElementIndexEqualsByText(List<org.openqa.selenium.WebElement> listValue, String option)returns the index of text value in a liststatic intgetElementIndexInList(EnhancedBy srcList, EnhancedBy target)find the index of the target element in list eg.static intgetElementIndexInList(List<org.openqa.selenium.WebElement> srcList, org.openqa.selenium.WebElement target)find the index of the target element in list eg.static org.openqa.selenium.PointgetElementPosition(EnhancedBy by)get element position on displaystatic org.openqa.selenium.PointgetElementPosition(EnhancedBy by, int index)get element position on displaystatic org.openqa.selenium.PointgetElementPosition(List<org.openqa.selenium.WebElement> elements, int index)get element position on displaystatic org.openqa.selenium.PointgetElementPosition(org.openqa.selenium.WebElement element)get element position on displaystatic org.openqa.selenium.DimensiongetElementSize(EnhancedBy by)returns element dimensionstatic org.openqa.selenium.DimensiongetElementSize(org.openqa.selenium.WebElement element)returns element dimensionstatic FilegetFile(String directoryPath)get file from file pathstatic FilegetFileByName(String path, String filename)get file by namestatic FilegetFileByName(String path, String filename, boolean includeSubDir)get file by namestatic StringgetFileContent(String absolutePath)gets file content as Stringstatic StringgetFileContent(String absolutePath, boolean verifyFileExists)gets file content as Stringstatic ArrayList<File>getFileList(String directoryPath)returns the list of files in directorystatic ArrayList<File>getFileList(String directoryPath, boolean includeSubDir)returns the list of files in directorystatic ArrayList<File>getFileListByType(String directoryPath, String type)gets the list of filesstatic ArrayList<File>getFileListByType(String directoryPath, String type, boolean includeSubtype)gets the list of filesstatic List<File>getFileListWithSubfolders(String directoryName, String type, List<File> files)gets list of files including from sub folder based on type.static List<File>getFileListWithSubfolders(String directoryName, List<File> files)gets list of files including from sub folder based on type.static intgetFirstNumber(String value)static StringgetFullPath(String path)gets full path from relative path relative path is from root directory ( where pom.xml file is located )static intgetIntFromString(String value)get numeric value from stringstatic intgetIntFromString(String value, boolean isFailOnNoInt)get numeric value from stringstatic io.appium.java_client.ios.IOSDrivergetiOSDriver()static List<String>getLinesInFileContainingWith(String value, File file)get line in file containing stringstatic List<String>getLinesInFileStartingWith(String value, File file)get line in file starting with stringstatic intgetListCount(EnhancedBy listValue)returns the number of elements in liststatic intgetListCount(List<org.openqa.selenium.WebElement> listValue)returns the number of elements in liststatic List<String>getListValues(EnhancedBy listValue)returns the list of values in a liststatic List<String>getListValues(List<org.openqa.selenium.WebElement> listValue)returns the list of values in a liststatic intgetNumber(String value)get numeric value from stringstatic StringgetPageSource()gets page sourcestatic StringgetPageTitle()returns the title of the pagestatic StringgetRootDir()get current directoryList<String>getRowValuesFromList(EnhancedBy srclist, int index, EnhancedBy rows)returns the list of string values for a row of elementsList<String>getRowValuesFromList(List<org.openqa.selenium.WebElement> srcList, int index, org.openqa.selenium.WebElement rows)returns the list of string values for a row of elementsstatic intgetStringIndexContainByText(List<String> stringList, String option)returns the index of string value in list of stringsstatic intgetStringIndexEqualsByText(List<String> stringList, String option)returns the index of string value in list of stringsHashMap<String,List<String>>getTableMap(EnhancedBy columns, int columnInitialIndex, EnhancedBy dataRows, int rowInitialIndex, EnhancedBy dataCells, int maxRows)gets hashmap representation of data column with row valuesHashMap<String,List<String>>getTableMap(EnhancedBy columns, EnhancedBy dataRows, EnhancedBy dataCells)gets hashmap representation of data column with row valuesHashMap<String,List<String>>getTableMap(EnhancedBy columns, EnhancedBy dataRows, EnhancedBy dataCells, int maxRows)gets hashmap representation of data column with row valuesstatic List<String>getTextList(EnhancedBy listValue)returns the list of values in a liststatic List<String>getTextList(List<org.openqa.selenium.WebElement> listValue)returns the list of values in a liststatic StringgetTextValue(EnhancedBy element)gets the text value from an elementstatic StringgetTextValue(EnhancedBy element, int index)gets the text value from an elementstatic StringgetTextValue(org.openqa.selenium.WebElement target)gets the text value from an elementstatic StringgetTextValue(org.openqa.selenium.WebElement target, int index)gets the text value from an elementstatic voidgetUrl(String url)navigate to a different urlstatic StringgetValueFromPattern(String str, String pattern)static List<String>getValuesFromPattern(String str, String pattern)static org.openqa.selenium.WebDrivergetWebdriver()get current webdriverstatic voidhandleDifferentUser()if single signin enabled, And new test user is different form previous, shutdown webdriver And restartstatic voidhighLightWebElement(EnhancedBy by, int index)highlights the web element use on clicks and send key elementsstatic voidhighLightWebElement(List<org.openqa.selenium.WebElement> elements, int index)highlights the web element use on clicks and send key elementsstatic voidhoverBy(EnhancedBy by)hover over elementstatic voidhoverBy(EnhancedBy by, int index)hover over elementstatic voidhoverBy(List<org.openqa.selenium.WebElement> elements, int index)hover over elementstatic voidhoverBy(org.openqa.selenium.WebElement element)hover over elementstatic voidhoverPoints(int x, int y)Hover on the x,y pointsvoidinputTextByAction(EnhancedBy by, String text)voidinputTextByAction(org.openqa.selenium.WebElement element, String text)static booleanisAndroid()is android driverstatic booleanisAttributeContaining(EnhancedBy by, String attribute, String value)returns true if element contains attribute valuestatic booleanisAttributeContaining(org.openqa.selenium.WebElement element, String attribute, String value)returns true if element contains attribute valuestatic booleanisBoolean(String value)returns if string is booleanbooleanisChrome()static booleanisContainedInList(EnhancedBy listValue, String option)return if element is contained in liststatic booleanisContainedInList(List<org.openqa.selenium.WebElement> listValue, String option)return if element is contained in liststatic booleanisDisplayed(EnhancedBy element)returns true if element is displayedstatic booleanisDisplayed(org.openqa.selenium.WebElement target)returns true if element is displayedstatic booleanisElementContainingClass(EnhancedBy by, String classValue)returns true if element contains class valuestatic booleanisElementContainingClass(org.openqa.selenium.WebElement element, String classValue)returns true if element contains class valuestatic booleanisElementContainingText(EnhancedBy element, String text)returns true if element contains textstatic booleanisElementContainingText(List<org.openqa.selenium.WebElement> target, String text)returns true if element contains textbooleanisElementEditable(EnhancedBy element)attempts to set text value on element, if not successful, then element is not editablebooleanisElementEditable(EnhancedBy element, int index)attempts to set text value on element, if not successful, then element is not editablebooleanisElementEditable(org.openqa.selenium.WebElement target)attempts to set text value on element, if not successful, then element is not editablebooleanisElementEditable(org.openqa.selenium.WebElement target, int index)attempts to set text value on element, if not successful, then element is not editablestatic booleanisExactMatchInList(EnhancedBy listValue, String option)return if element is an exact match in liststatic booleanisExactMatchInList(List<org.openqa.selenium.WebElement> listValue, String option)return if element is an exact match in liststatic booleanisFileContainsString(String value, File file)does file contain the given text valuestatic booleanisFileContainString(String value, File file)does file contain the given text valuebooleanisFirefox()static booleanisInternetExplorer()returns true if browser is iestatic booleanisIOS()is ios driverstatic booleanisMac()returns true if OS is macbooleanisMicrosoftEdge()static booleanisNumeric(String value)return if string is a numberstatic booleanisPresent(EnhancedBy element)returns true if element is displayedstatic booleanisPresent(org.openqa.selenium.WebElement target)returns true if element is displayedstatic booleanisProxyRequired(URL url)get proxy state from proxy enabled config values: true, false, auto if auto is set, then through proxy detection, we set value to true or falsebooleanisSafari()static booleanisServerOnline(String url, String proxyUrl)checks if server is onlinestatic booleanisStringContainNumber(String value)does string have numeric valuestatic booleanisStringContainOnlyNumber(String value)does string have only numeric valuestatic booleanisTextDisplayed(String text)is text displayed on pagestatic booleanisUnix()returns true if OS is unix or linuxstatic booleanisUrlAbleToConnect(URL source, Proxy proxy)check if able to connect to source urlstatic booleanisUUID(String value)is the string value UDIDstatic BooleanisVisibleInViewport(EnhancedBy by)returns true if the element is visible in the current page only for web applicationsstatic BooleanisVisibleInViewport(EnhancedBy by, int index)returns true if the element is visible in the current page only for web applicationsstatic BooleanisVisibleInViewport(List<org.openqa.selenium.WebElement> elements, int index)returns true if the element is visible in the current page only for web applicationsstatic BooleanisVisibleInViewport(org.openqa.selenium.WebElement element)returns true if the element is visible in the current page only for web applicationsstatic booleanisWebDriver()is web driverstatic booleanisWindows()returns true if OS is windowsstatic voidkillMacProcess(String serviceName)returns kills the process if runningstatic voidkillWindowsProcess(String serviceName)returns kills the process if runningstatic voidlocalizationLoadJson(String fileName)loads localization map from a json file to the test object datastatic voidlocalizationSetupCsv(String language)sets the language for csv localization filestatic Stringlocalize(String key)gets local language from json file specified in properties filestatic voidlogStackTrace(AssertionError e)static voidlogStackTrace(Exception e)static voidmaximizePage()maximizes web pageSet<String>mobile_getContextList()returns the list of mobile context.static voidmobile_hideKeyboard()hides ios or android keyboardstatic booleanmobile_isMobile()returns if mobile driver is usedstatic voidmobile_longPress(EnhancedBy target, long miliSeconds)press per retry presses the target elementstatic voidmobile_longPress(org.openqa.selenium.WebElement target, long miliSeconds)press per retry presses the target elementstatic voidmobile_longPressAndExpect(EnhancedBy target, long miliSeconds, EnhancedBy expected)long press And expect elementstatic voidmobile_longPressAndExpect(org.openqa.selenium.WebElement target, long miliSeconds, org.openqa.selenium.WebElement expected)long press And expect elementstatic voidmobile_resetApp()resets the appstatic voidmobile_scrollToElement(EnhancedBy target)scrolls to mobile element until element is becomes visiblestatic voidmobile_scrollToElement(org.openqa.selenium.WebElement target)scrolls to mobile element until element is becomes visiblestatic voidmobile_setLocation(org.openqa.selenium.html5.Location location)sets gps location on ios simulatorvoidmobile_swipeDown(double durationInSeconds)swipe down on the screenvoidmobile_swipeDown(EnhancedBy element, int index, double durationInSeconds)swipe down on the screen based on element positionvoidmobile_swipeDown(List<org.openqa.selenium.WebElement> elements, int index, double durationInSeconds)swipe down on the screen based on element positionvoidmobile_swipeLeft(double durationInSeconds)swipe right on the screenvoidmobile_swipeLeft(EnhancedBy element, int index, double durationInSeconds)swipe left on the screen based on element positionvoidmobile_swipeLeft(List<org.openqa.selenium.WebElement> elements, int index, double durationInSeconds)swipe left on the screen based on element positionvoidmobile_swipeRight(double durationInSeconds)swipe right on the screenvoidmobile_swipeRight(EnhancedBy element, int index, double durationInSeconds)swipe right on the screen based on element positionvoidmobile_swipeRight(List<org.openqa.selenium.WebElement> elements, int index, double durationInSeconds)swipe right on the screen based on element positionvoidmobile_swipeUp(double durationInSeconds)swipe up on the screenvoidmobile_swipeUp(EnhancedBy element, int index, double durationInSeconds)swipe up on the screen based on element positionvoidmobile_swipeUp(List<org.openqa.selenium.WebElement> elements, int index, double durationInSeconds)swipe up on the screen based on element positionstatic voidmobile_switchToNativeView()sets native context for android And ios appsvoidmobile_switchToView(String view)switch to viewstatic voidmobile_switchToWebView()sets web context for android And ios appsstatic voidmobile_waitAndRefreshForElementToLoad(EnhancedBy target)waits for element to load And refreshes the app each time to renew the domstatic voidmobile_waitAndRefreshForElementToLoad(EnhancedBy target, int time)waits for element to load And refreshes the app each time to renew the domstatic voidmobile_waitAndRefreshForElementToLoad(org.openqa.selenium.WebElement target)waits for element to load And refreshes the app each time to renew the domstatic voidmobile_waitAndRefreshForElementToLoad(org.openqa.selenium.WebElement target, int time)waits for element to load And refreshes the app each time to renew the domstatic voidmobile_zoomIn(int zoomLevel)zoom in based on zoom levels.static voidmobile_zoomIn(EnhancedBy indicator)zooms in And checks if target level indicator has been reachedstatic voidmobile_zoomIn(org.openqa.selenium.WebElement indicator)zooms in And checks if target level indicator has been reachedstatic voidmobile_zoomOut(int zoomLevel)zoom in based on zoom levels.static voidmobile_zoomOut(EnhancedBy indicator)zooms out And checks if target level indicator has been reachedstatic voidmobile_zoomOut(org.openqa.selenium.WebElement indicator)zooms out And checks if target level indicator has been reachedstatic voidmoveToElement(EnhancedBy target, int index)move to element by using actionstatic voidmoveToElement(EnhancedBy target, int index, int xOffset, int yOffset)move to element by using actionstatic voidmoveToElement(List<org.openqa.selenium.WebElement> targets, int index)move to element by using actionstatic voidmoveToElement(List<org.openqa.selenium.WebElement> targets, int index, int xOffset, int yOffset)move to element by using actionstatic voidnavigateBack()navigates backstatic voidnavigateForward()navigate forwardstatic voidnavigateToUrl(String url)navigate to a different urlstatic voidpressEnterOnAndroid()select enter on androidstatic voidprintPageSource()prints page source to consolestatic voidquitAllCurrentTestDrivers()quits all drivers in the current teststatic voidquitCurrentDriver()quits the current web driverstatic voidquitDriver(org.openqa.selenium.WebDriver driver)quit driverstatic StringreadFileContent(String absolutePath)gets file content as Stringstatic voidrefreshMobileApp()places the app in background And Then relaunches itstatic voidrefreshPage()reload pagestatic voidrefreshPageSource()gets page sourcestatic StringremoveSurroundingQuotes(String value)remove surrounding double quotes from the stringstatic voidrightClick(EnhancedBy target, int index)right click on element at indexstatic voidrightClick(org.openqa.selenium.WebElement target, int index)right click on element at indexstatic voidrunApiContaining(String identifier, String prefix, String getApi, String targetApiId, String variable, String targerApi)runApiContaining("name", "zzz_","getCompanies", "id","companyId","deleteCompany") get all companies with name containing zzz_, Then gets id of these companies, stores them in companyId variable And calls deleteCompanystatic voidrunApiEquals(String identifier, String value, String getApi, String targetApiId, String variable, String targerApi)runApiEquals("name", "test123","getCompanies", "id","companyId","deleteCompany") get all companies with name equals test123, Then gets id of these companies And calls delete with idstatic ObjectrunInternalClass(String sourcePath, String methodName, List<KeyValue> parameterList)runs method from external classstatic voidscreenshotCapture()static voidscrollBottomPageBrowser()scroll to bottom of browserstatic voidscrollDown()scrolls down androidstatic voidscrollDownBrowser()scroll down the browserstatic voidscrollDownBrowser(int count)scroll down the browserstatic voidscrollToWebElement(EnhancedBy element)scroll to web elementstatic voidscrollToWebElement(EnhancedBy element, int index)scroll to elementstatic voidscrollToWebElement(List<org.openqa.selenium.WebElement> elements, int index)scroll to elementstatic voidscrollToWebElement(org.openqa.selenium.WebElement element)scroll to web elementstatic voidscrollUpBrowser()scroll up the browserstatic voidscrollUpBrowser(int count)scroll up the browserstatic voidsearchAndWaitForResults(String searchQuery, EnhancedBy byTarget, EnhancedBy spinner)enters value into the search field And selects enter waits for the loading spinner to be removedstatic voidsearchAndWaitForResults(String searchQuery, org.openqa.selenium.WebElement target, org.openqa.selenium.WebElement spinner)enters value into the search field And selects enter waits for the loading spinner to be removedstatic voidselectCheckBox(EnhancedBy button, boolean isSelect)selects checkbox based on by valuestatic voidselectCheckBox(org.openqa.selenium.WebElement button, boolean isSelect)selects checkbox based on by valuestatic voidselectDropDown(int index, EnhancedBy field, EnhancedBy listValue)select drop down by index from the drop down liststatic voidselectDropDown(int index, org.openqa.selenium.WebElement field, List<org.openqa.selenium.WebElement> listValue)select drop down by index from the drop down liststatic voidselectDropDown(EnhancedBy field, EnhancedBy item)select drop down using by value of the list itemstatic voidselectDropDown(EnhancedBy field, EnhancedBy list, String... options)selects drop downstatic voidselectDropDown(String option, EnhancedBy field, int index, EnhancedBy listValue)selects drop down based on index of the drop down fieldstatic voidselectDropDown(String option, EnhancedBy field, int index, EnhancedBy list, int listIndex)select drop down based on index of the drop down list eg.static voidselectDropDown(String option, EnhancedBy field, EnhancedBy listValue)Deprecated.replaced by selectDropDown(field, list, options) selects drop downstatic voidselectDropDown(String option, EnhancedBy field, EnhancedBy listValue, int listIndex)select drop down based on index of the drop down list eg.static voidselectDropDown(String option, EnhancedBy field, String field_Identifier, EnhancedBy listValue)selects drop down from list defined by another list defined by textstatic voidselectDropDown(String option, List<org.openqa.selenium.WebElement> field, int index, org.openqa.selenium.WebElement listValue)selects drop down based on index of the drop down fieldstatic voidselectDropDown(String option, List<org.openqa.selenium.WebElement> field, int index, org.openqa.selenium.WebElement list, int listIndex)select drop down based on index of the drop down list eg.static voidselectDropDown(String option, List<org.openqa.selenium.WebElement> field, String field_Identifier, List<org.openqa.selenium.WebElement> listValue)selects drop down from list defined by another list defined by textstatic voidselectDropDown(String option, org.openqa.selenium.WebElement field, List<org.openqa.selenium.WebElement> listValue)Deprecated.replaced by selectDropDown(field, list, options) selects drop downstatic voidselectDropDown(String option, org.openqa.selenium.WebElement field, List<org.openqa.selenium.WebElement> listValue, int listIndex)select drop down based on index of the drop down list eg.static voidselectDropDown(List<org.openqa.selenium.WebElement> field, int index)selects drop downstatic voidselectDropDown(org.openqa.selenium.WebElement field, String... options)selects drop downstatic voidselectDropDown(org.openqa.selenium.WebElement field, List<org.openqa.selenium.WebElement> item)select drop down using by value of the list itemstatic voidselectDropDown(org.openqa.selenium.WebElement field, List<org.openqa.selenium.WebElement> list, String... options)selects drop downstatic voidselectDropDownWithDoubleClick(String option, EnhancedBy field, int index, EnhancedBy listValue)selects dropdown by double clicking on the fieldstatic voidselectDropDownWithDoubleClick(String option, EnhancedBy field, EnhancedBy listValue)selects dropdown by double clicking on the fieldstatic voidselectDropDownWithDoubleClick(String option, org.openqa.selenium.WebElement field, int index, List<org.openqa.selenium.WebElement> listValue)selects dropdown by double clicking on the fieldstatic voidselectDropDownWithDoubleClick(String option, org.openqa.selenium.WebElement field, List<org.openqa.selenium.WebElement> listValue)selects dropdown by double clicking on the fieldstatic voidselectElementContainedInList(EnhancedBy listValue, String option, EnhancedBy target)Selects list item from a parent container eg.static voidselectElementContainedInList(EnhancedBy listValue, String option, EnhancedBy target, int targetIndex)Selects list item from a parent container eg.static voidselectElementContainedInList(List<org.openqa.selenium.WebElement> listValue, String option, org.openqa.selenium.WebElement target)Selects list item from a parent container eg.static voidselectElementContainedInList(List<org.openqa.selenium.WebElement> listValue, String option, org.openqa.selenium.WebElement target, int targetIndex)Selects list item from a parent container eg.static voidselectElementInList(EnhancedBy listValue, int index)selects an element in list by its index valuestatic voidselectElementInList(EnhancedBy listValue, int index, EnhancedBy expected)selects an element in list by its index value And waits for expected elementstatic voidselectElementInList(List<org.openqa.selenium.WebElement> listValue, int index)selects an element in list by its index valuestatic voidselectListItemByIndex(EnhancedBy listValue, int index)selects list item by the string option providedstatic voidselectListItemByIndex(List<org.openqa.selenium.WebElement> listValue, int index)selects list item by the string option providedstatic voidselectListItemContainsByName(EnhancedBy listValue, String option)finds target element which is in the same container And has the same index as the parent eg.static voidselectListItemContainsByName(EnhancedBy listValue, String option, EnhancedBy target)selects list item containing string eg.static voidselectListItemContainsByName(List<org.openqa.selenium.WebElement> listValue, String option)finds target element which is in the same container And has the same index as the parent eg.static voidselectListItemContainsByName(List<org.openqa.selenium.WebElement> listValue, String option, org.openqa.selenium.WebElement target)selects list item containing string eg.static voidselectListItemEqualsByName(EnhancedBy listValue, String option)selects list item by the string option providedstatic voidselectListItemEqualsByName(EnhancedBy listValue, String option, EnhancedBy target)finds target element which is in the same container And has the same index as the parent eg.static voidselectListItemEqualsByName(List<org.openqa.selenium.WebElement> listValue, String option)selects list item by the string option providedstatic voidselectListItemEqualsByName(List<org.openqa.selenium.WebElement> listValue, String option, org.openqa.selenium.WebElement target)finds target element which is in the same container And has the same index as the parent eg.static voidselectMultipleCheckboxOptions(List<String> selections, EnhancedBy checkboxes)selects multiple checkbox optionsstatic voidselectMultipleCheckboxOptions(List<String> selections, org.openqa.selenium.WebElement checkboxes)selects multiple checkbox optionsstatic voidselectRadioButton(EnhancedBy button)selects a buttonstatic voidselectRadioButton(String option, EnhancedBy buttons)selects radio button by radio button descriptionstatic voidselectRadioButton(String option, org.openqa.selenium.WebElement buttons)selects radio button by radio button descriptionstatic voidselectRadioButton(org.openqa.selenium.WebElement button)selects a buttonstatic voidsendMail(EmailObject email)sends email to recipient using email objectstatic voidsetAttribute(EnhancedBy by, int index, String attribute, String value)sets attribute value of an elementstatic voidsetAttribute(EnhancedBy by, String attribute, String value)sets attribute value of an elementstatic voidsetAttribute(List<org.openqa.selenium.WebElement> elements, int index, String attribute, String value)sets attribute value of an elementstatic voidsetAttribute(org.openqa.selenium.WebElement element, String attribute, String value)sets attribute value of an elementstatic voidsetChildField(EnhancedBy parent, int parentIndex, EnhancedBy child, int childIndex, CharSequence... value)sets key based on nested text fieldstatic voidsetChildField(List<org.openqa.selenium.WebElement> parent, int parentIndex, List<org.openqa.selenium.WebElement> child, int childIndex, CharSequence... value)sets key based on nested text fieldstatic voidsetDriver(org.openqa.selenium.WebDriver driver)static voidsetField(EnhancedBy field, CharSequence... value)set field value if value is not emptystatic voidsetField(String value, EnhancedBy field, int index)sets field text value by index hides keyboard if on ios devicestatic voidsetField(String value, List<org.openqa.selenium.WebElement> field, int index)sets field text value by index hides keyboard if on ios devicestatic voidsetField(org.openqa.selenium.WebElement field, CharSequence... value)set field value if value is not emptystatic voidsetFieldAndEnter(EnhancedBy field, CharSequence... value)sets field And presses the enter keystatic voidsetFieldAndEnter(org.openqa.selenium.WebElement field, CharSequence... value)sets field And presses the enter keystatic voidsetFieldByAction(EnhancedBy field, int index, CharSequence... value)static voidsetFieldByAction(EnhancedBy field, CharSequence... value)static voidsetFieldByAction(List<org.openqa.selenium.WebElement> field, int index, CharSequence... value)static voidsetFieldByAction(org.openqa.selenium.WebElement field, CharSequence... value)static voidsetFieldByJs(EnhancedBy field, int index, CharSequence... value)static voidsetFieldByJs(EnhancedBy field, CharSequence... value)static voidsetFieldByJs(List<org.openqa.selenium.WebElement> field, int index, CharSequence... value)static voidsetFieldByJs(org.openqa.selenium.WebElement field, CharSequence... value)static voidsetKey(org.openqa.selenium.Keys key, EnhancedBy field)sendstatic voidsetKey(org.openqa.selenium.Keys key, org.openqa.selenium.WebElement field)sendstatic voidsetLegacyDriver(org.openqa.selenium.WebDriver driver)static voidsetLegacyDriver(org.openqa.selenium.WebDriver driver, boolean isPropertyDisabled, int timeoutSec, int implicitSec)static voidsetPageSize(int x, int y)sets page sizestatic org.testng.asserts.SoftAssertsoftAssert()static voidsoftAssertAll()static voidsoftAssertEqual(int expected, int actual)static voidsoftAssertEqual(String expected, String actual)static voidsoftAssertTrue(String message, boolean value)static StopWatchHelperstart()StopWatchHelper watch = Helper.start(); do something long passedTimeInMs = watch.time(); long passedTimeInSeconds = watch.time(TimeUnit.SECONDS);static StringstringNormalize(String value)normalizes string removes space, new line charsstatic StringstringRemoveLines(String value)normalizes string removes space, new line charsstatic voidswitchDriver(org.openqa.selenium.WebDriver driver)switch webdriver use for switching between different driversstatic voidswitchIframe(EnhancedBy frame)switches frame to frame specifiedstatic voidswitchIframe(org.openqa.selenium.WebElement frame)switches frame to frame specifiedstatic voidswitchToDefaultFrame()switches to default framestatic voidswitchToNewWindow(String defaultWindow)switch to the new opened windowstatic voidswitchToNextTab()switch to next tabstatic voidswitchToPreviousTab()switch to next tab circles back to initial tab if it reaches the last tabstatic voidswitchToTab(int index)switch to previous tab circle back to the last tabstatic voidswtichUrl(String url)navigate to a different urlstatic voiduploadFile(String location, EnhancedBy imageButton)uploads file by specifying file location relative to main pathstatic voiduploadFile(String location, org.openqa.selenium.WebElement imageButton)uploads file by specifying file location relative to main pathstatic voiduploadImage(String location, EnhancedBy imageButton, EnhancedBy images)sets the image based on locationstatic voiduploadImage(String location, org.openqa.selenium.WebElement imageButton, org.openqa.selenium.WebElement images)sets the image based on locationstatic voiduploadImages(List<String> locations, EnhancedBy imageButton, EnhancedBy images)sets the image based on locationstatic voiduploadImages(List<String> locations, org.openqa.selenium.WebElement imageButton, org.openqa.selenium.WebElement images)sets the image based on locationstatic voidverifyAnyText(EnhancedBy target, String... values)verifies if text contains any of values in liststatic voidverifyAnyText(org.openqa.selenium.WebElement target, String... values)verifies if text contains any of values in liststatic voidverifyAnyTextContaining(EnhancedBy target, String... values)verifies if text contains any of values in liststatic voidverifyAnyTextContaining(org.openqa.selenium.WebElement target, String... values)verifies if text contains any of values in liststatic voidverifyContainsIsInList(EnhancedBy listValue, String option)verifies if option value is in the list index = -1 indicates the value is not in liststatic voidverifyContainsIsInList(List<org.openqa.selenium.WebElement> listValue, String option)verifies if option value is in the list index = -1 indicates the value is not in liststatic voidverifyElementContainingText(EnhancedBy element, String text)verify if element contains textstatic voidverifyElementContainingText(List<org.openqa.selenium.WebElement> target, String text)verify if element contains textstatic voidverifyElementCount(EnhancedBy by, int value, int... correction)verifies element countstatic voidverifyElementCount(List<org.openqa.selenium.WebElement> target, int value, int... correction)verifies element countstatic voidverifyElementIsDisplayed(EnhancedBy by)verifies if element(s) is (are) displayedstatic voidverifyElementIsDisplayed(org.openqa.selenium.WebElement target)verifies if element(s) is (are) displayedstatic voidverifyElementIsNotDisplayed(EnhancedBy by)verifies if element(s) is (are) not displayedstatic voidverifyElementIsNotDisplayed(org.openqa.selenium.WebElement target)verifies if element(s) is (are) not displayedstatic voidverifyElementText(EnhancedBy by, String value)verifies element text equals provided valuestatic voidverifyElementText(org.openqa.selenium.WebElement target, String value)verifies element text equals provided valuestatic voidverifyIsInList(EnhancedBy listValue, String option)verifies if option value is in the list index = -1 indicates the value is not in liststatic voidverifyIsInList(EnhancedBy listValue, String indicator, String option)verify text option in list based on key value in the liststatic voidverifyIsInList(List<org.openqa.selenium.WebElement> listValue, String option)verifies if option value is in the list index = -1 indicates the value is not in liststatic voidverifyIsInList(List<org.openqa.selenium.WebElement> listValue, String indicator, String option)verify text option in list based on key value in the liststatic voidverifyNumberOfTabs(int tabs)switch to tab by indexstatic voidverifyTextDisplayed(String text)verify if text is displayed on pagestatic voidverifyTitle(String appTitle)verify page titlevoidverifyToolTip(EnhancedBy tooltip, int index, String text)verify tool tip is displayedvoidverifyToolTip(List<org.openqa.selenium.WebElement> tooltip, int index, String text)verify tool tip is displayedstatic voidwaitForAdditionalElementsToLoad(EnhancedBy target, int originalCount)waits for element count to increase from the originalCount Usefull When waiting for a list to expand with additional itemsstatic voidwaitForAdditionalElementsToLoad(EnhancedBy target, int originalCount, int time)waits for element count to increase from the originalCount Usefull When waiting for a list to expand with additional itemsstatic voidwaitForAdditionalElementsToLoad(org.openqa.selenium.WebElement target, int originalCount)waits for element count to increase from the originalCount Usefull When waiting for a list to expand with additional itemsstatic voidwaitForAdditionalElementsToLoad(org.openqa.selenium.WebElement target, int originalCount, int time)waits for element count to increase from the originalCount Usefull When waiting for a list to expand with additional itemsstatic booleanwaitForAnyTextToLoad(EnhancedBy target, int time, String... text)wait for any text strings to become availablestatic booleanwaitForAnyTextToLoad(EnhancedBy target, String... text)wait for any text strings to become availablestatic booleanwaitForAnyTextToLoad(List<org.openqa.selenium.WebElement> elements, int time, String... text)wait for any text strings to become availablestatic booleanwaitForAnyTextToLoad(org.openqa.selenium.WebElement target, String... text)wait for any text strings to become availablestatic booleanwaitForAnyTextToLoadContaining(EnhancedBy target, int time, String... text)wait for any text strings to become availablestatic booleanwaitForAnyTextToLoadContaining(EnhancedBy target, String... text)wait for any text strings to become availablestatic booleanwaitForAnyTextToLoadContaining(org.openqa.selenium.WebElement target, int time, String... text)wait for any text strings to become availablestatic booleanwaitForAnyTextToLoadContaining(org.openqa.selenium.WebElement target, String... text)wait for any text strings to become availablebooleanwaitForClassContain(EnhancedBy target, int index, String value)wait for class to containbooleanwaitForClassContain(EnhancedBy target, int index, String value, int time)wait for class to contain valuebooleanwaitForClassContain(List<org.openqa.selenium.WebElement> elements, int index, String value)wait for class to containbooleanwaitForClassContain(org.openqa.selenium.WebElement target, int index, String value, int time)wait for class to contain valuestatic booleanwaitForElementToBeClickable(EnhancedBy selector)wait for element to become clickable causes instability with hybrid mobile appstatic booleanwaitForElementToBeClickable(EnhancedBy selector, int timeInSeconds)wait for element to become clickable causes instability with hybrid mobile appstatic booleanwaitForElementToBeClickable(org.openqa.selenium.WebElement selector)wait for element to become clickable causes instability with hybrid mobile appstatic booleanwaitForElementToBeClickable(org.openqa.selenium.WebElement selector, int timeInSeconds)wait for element to become clickable causes instability with hybrid mobile appstatic booleanwaitForElementToBeRemoved(EnhancedBy target)waits for element to not be displayed wait for maximum of 60 secondsstatic booleanwaitForElementToBeRemoved(EnhancedBy target, int time)waits for element to not be displayedstatic booleanwaitForElementToBeRemoved(EnhancedBy target, int time, int waitForTargetToLoadInSeconds)waits for element to not be displayedstatic booleanwaitForElementToBeRemoved(org.openqa.selenium.WebElement target)waits for element to not be displayed wait for maximum of 60 secondsstatic booleanwaitForElementToBeRemoved(org.openqa.selenium.WebElement target, int time)waits for element to not be displayedstatic booleanwaitForElementToBeRemoved(org.openqa.selenium.WebElement target, int time, int waitForTargetToLoadInSeconds)waits for element to not be displayedstatic voidwaitForElementToLoad(EnhancedBy target)waits for element to be displayed for amount of time specified by 60 secondsstatic booleanwaitForElementToLoad(EnhancedBy target, int time)waits for element to load count() checks if the element is displayed Then gets the count numberstatic booleanwaitForElementToLoad(EnhancedBy target, int time, int count)waits for element to load If mobile device, scrolls down the page until element is visiblestatic voidwaitForElementToLoad(org.openqa.selenium.WebElement target)waits for element to be displayed for amount of time specified by 60 secondsstatic booleanwaitForElementToLoad(org.openqa.selenium.WebElement target, int time)waits for element to load count() checks if the element is displayed Then gets the count numberstatic booleanwaitForElementToLoad(org.openqa.selenium.WebElement target, int time, int count)waits for element to load If mobile device, scrolls down the page until element is visiblestatic booleanwaitForFirstElementToLoad(EnhancedBy element1, EnhancedBy element2)waits for either element to load returns true When first item loadsstatic booleanwaitForFirstElementToLoad(EnhancedBy element1, EnhancedBy element2, int time)waits for either element to load returns true When first item loadsstatic booleanwaitForFirstElementToLoad(EnhancedBy element1, EnhancedBy element2, EnhancedBy element3)waits for either element to load returns true When first item loadsstatic booleanwaitForFirstElementToLoad(EnhancedBy element1, EnhancedBy element2, EnhancedBy element3, int time)waits for either element to load returns true When first item loadsstatic booleanwaitForFirstElementToLoad(org.openqa.selenium.WebElement element1, org.openqa.selenium.WebElement element2)waits for either element to load returns true When first item loadsstatic booleanwaitForFirstElementToLoad(org.openqa.selenium.WebElement element1, org.openqa.selenium.WebElement element2, int time)waits for either element to load returns true When first item loadsstatic booleanwaitForFirstElementToLoad(org.openqa.selenium.WebElement element1, org.openqa.selenium.WebElement element2, org.openqa.selenium.WebElement element3)waits for either element to load returns true When first item loadsstatic booleanwaitForFirstElementToLoad(org.openqa.selenium.WebElement element1, org.openqa.selenium.WebElement element2, org.openqa.selenium.WebElement element3, int time)waits for either element to load returns true When first item loadsstatic voidwaitForListItemToLoad_Contains(EnhancedBy list, String option)waits for item containing in list to loadstatic voidwaitForListItemToLoad_Contains(org.openqa.selenium.WebElement list, String option)waits for item containing in list to loadstatic voidwaitForPageToLoad()waits for webpage to loadstatic voidwaitForSeconds(double seconds)waits for number of secondsstatic voidwaitForTextToLoad(EnhancedBy target, int time, String text)make sure only one element And caller needs to take responsibility to have text in the elementstatic voidwaitForTextToLoad(EnhancedBy target, String text)waits for text to be loaded for amount of time specified by 60 secondsstatic voidwaitForTextToLoad(org.openqa.selenium.WebElement target, int time, String text)make sure only one element And caller needs to take responsibility to have text in the elementstatic voidwaitForTextToLoad(org.openqa.selenium.WebElement target, String text)waits for text to be loaded for amount of time specified by 60 secondsstatic voidwriteFile(String value, String absolutePath)Create file (where pom.xml is) and write to itstatic voidwriteFile(String value, String path, String filename, String type)Create file with path starting from root directory (where pom.xml is) and write to it.static ZipOutputStreamzipFolder(String srcFolder, String destZipFile)zip folder-
Methods inherited from class core.helpers.Helper
click, findElements, findElements, findElements, getConfigBooleanValue, getConfigDoubleValue, getConfigIntValue, getConfigObjectValue, getConfigValue, isServerOnline, selectDropDown, waitForElementToBeVisible
-
-
-
-
Field Detail
-
click
public static ClickHelper click
-
wait
public static WaitHelper wait
-
mobile
public static MobileHelper mobile
-
list
public static ListHelper list
-
page
public static PageHelper page
-
form
public static FormHelper form
-
image
public static ImageProcessingHelper image
-
date
public static DateHelper date
-
csv
public static CsvHelper csv
-
loginbuilder
public static Loginbuilder loginbuilder
-
verify
public static VerifyHelper verify
-
clickJs
public static ClickHelperJs clickJs
-
clickAction
public static ClickHelperAction clickAction
-
-
Method Detail
-
excel_setExcelFile
public static ExcelObject excel_setExcelFile(ExcelObject excel) throws Exception
gets the excel file And the work sheet- Parameters:
Path-SheetName-- Throws:
Exception
-
excel_getColumData
public static List<String> excel_getColumData(ExcelObject excel) throws Exception
returns all the column data as array list of string- Parameters:
colNum-- Returns:
- Throws:
Exception
-
excel_getCellData
public static String excel_getCellData(ExcelObject excel) throws Exception
This method is to read the test data from the Excel cell, in this we are passing parameters as Row num And Col num- Parameters:
RowNum-ColNum-- Returns:
- Throws:
Exception
-
excel_setCellData
public static void excel_setCellData(ExcelObject excel) throws Exception
This method is to write in the Excel cell, Row num And Col num are the parameters- Parameters:
excel- - required: excel.row, excel.column, excel.value, excel.file- Throws:
Exception
-
excel_setCellData
public static void excel_setCellData(List<ExcelObject> excelObjects) throws Exception
- Parameters:
excelObjects- - contains data info- Throws:
Exception
-
setLegacyDriver
public static void setLegacyDriver(org.openqa.selenium.WebDriver driver)
-
setLegacyDriver
public static void setLegacyDriver(org.openqa.selenium.WebDriver driver, boolean isPropertyDisabled, int timeoutSec, int implicitSec)
-
findElements
protected static EnhancedWebElement findElements(org.openqa.selenium.WebElement parent, org.openqa.selenium.WebElement child)
finds element based on parent element- Parameters:
element-parent-- Returns:
-
findElements
protected static EnhancedWebElement findElements(org.openqa.selenium.WebElement element)
finds list of elements- Parameters:
element-- Returns:
-
findElements
protected static EnhancedWebElement findElements(org.openqa.selenium.WebElement parent, int parentIndex, org.openqa.selenium.WebElement child)
finds a list of elements based on parent element- Parameters:
element-parent-- Returns:
-
clickAndExpect
public static void clickAndExpect(org.openqa.selenium.WebElement target, org.openqa.selenium.WebElement expected)clicks target And waits for expected element to display retries 10 times- Parameters:
target-expected-
-
clickAndExpect
public static void clickAndExpect(List<org.openqa.selenium.WebElement> target, String text, org.openqa.selenium.WebElement expected)
click And expect based on the text value on the element. eg. button with "OK" text- Parameters:
target-text-expected-
-
clickAndExpectContainsByText
public void clickAndExpectContainsByText(List<org.openqa.selenium.WebElement> target, String text, org.openqa.selenium.WebElement expected)
click And expect based on the text value on the element. eg. button with "OK" text- Parameters:
target-text-expected-
-
clickAndExpect
public static void clickAndExpect(org.openqa.selenium.WebElement target, org.openqa.selenium.WebElement expected, boolean isMobileRefresh)clicks target And waits for expected element to display retries 10 times- Parameters:
target-expected-
-
clickAndExpect
public static void clickAndExpect(List<org.openqa.selenium.WebElement> target, int index, org.openqa.selenium.WebElement expected1, org.openqa.selenium.WebElement expected2)
clicks target And wait for one the 2 expected elements to appear- Parameters:
target-index-expected1-expected2-
-
clickAndExpect
public static void clickAndExpect(List<org.openqa.selenium.WebElement> target, int index, org.openqa.selenium.WebElement expected)
clicks element based on index And waits for expected element to be displayed- Parameters:
target-index-expected-
-
clickAndExpect
public static void clickAndExpect(org.openqa.selenium.WebElement target, org.openqa.selenium.WebElement expected, org.openqa.selenium.WebElement spinner)clicks target And waits for expected element to show up also waits for spinner element to be removed from display- Parameters:
target-expected-spinner-
-
clickAndNotExpect
public static void clickAndNotExpect(org.openqa.selenium.WebElement target, org.openqa.selenium.WebElement expected)clicks target And waits for expected to not be displayed retries 10 times- Parameters:
target-expected-
-
clickAndWait
public static void clickAndWait(org.openqa.selenium.WebElement target, double timeInSeconds)clicks target And waits for seconds- Parameters:
target-expected-
-
click
public static void click(org.openqa.selenium.WebElement target)
-
clickAndWait
public static void clickAndWait(org.openqa.selenium.WebElement target, int index, double timeInSeconds)clicks target And waits for seconds- Parameters:
target-expected-
-
clickAndNotExpect
public static void clickAndNotExpect(org.openqa.selenium.WebElement target, int index, org.openqa.selenium.WebElement expected)
-
clickElementLocationBy
public static void clickElementLocationBy(org.openqa.selenium.WebElement target, int x, int y)Click on an element's specific x,y location- Parameters:
by- by elementx- x offset coordinatey- y offset coordinate
-
clickPointsAndExpect
public static void clickPointsAndExpect(int x, int y, org.openqa.selenium.WebElement expected)click point at x,y coordinates and expect and element to be present retry every 5 seconds for duration of explicit timeout- Parameters:
x-y-expected-
-
doubleClick
public static void doubleClick(org.openqa.selenium.WebElement target, int index)double click on element- Parameters:
target-index-
-
rightClick
public static void rightClick(org.openqa.selenium.WebElement target, int index)right click on element at index- Parameters:
target-index-
-
clickElementContinsByText
public static void clickElementContinsByText(org.openqa.selenium.WebElement target, String text)click element with text containing- Parameters:
by-text-
-
clickAndHold
public static void clickAndHold(org.openqa.selenium.WebElement target, double seconds)click And hold element- Parameters:
target-seconds-
-
clickAndHold
public static void clickAndHold(List<org.openqa.selenium.WebElement> target, int index, double seconds)
click And hold based on element index- Parameters:
target-index-seconds-
-
dragAndDrop
public static void dragAndDrop(org.openqa.selenium.WebElement src, org.openqa.selenium.WebElement target)drag And drop from src element to target element- Parameters:
src-target-
-
dragAndDrop
public void dragAndDrop(List<org.openqa.selenium.WebElement> srcParent, int srcParentIndex, List<org.openqa.selenium.WebElement> srcChild, int scrChildIndex, List<org.openqa.selenium.WebElement> targetParent, int targeParenttIndex, List<org.openqa.selenium.WebElement> targetChild, int targetChildIndex)
drag And drop from src element to target element- Parameters:
src-target-
-
dragAndDrop
public static void dragAndDrop(org.openqa.selenium.WebElement src, int xOffset, int yOffset)drag And drop from src element to target element- Parameters:
src-target-
-
verifyElementIsDisplayed
public static void verifyElementIsDisplayed(org.openqa.selenium.WebElement target)
verifies if element(s) is (are) displayed- Parameters:
by-
-
isDisplayed
public static boolean isDisplayed(org.openqa.selenium.WebElement target)
returns true if element is displayed- Parameters:
element-- Returns:
-
isPresent
public static boolean isPresent(org.openqa.selenium.WebElement target)
returns true if element is displayed- Parameters:
element-- Returns:
-
isElementContainingText
public static boolean isElementContainingText(List<org.openqa.selenium.WebElement> target, String text)
returns true if element contains text- Parameters:
element-text-- Returns:
-
verifyElementContainingText
public static void verifyElementContainingText(List<org.openqa.selenium.WebElement> target, String text)
verify if element contains text- Parameters:
element-text-
-
verifyToolTip
public void verifyToolTip(List<org.openqa.selenium.WebElement> tooltip, int index, String text)
verify tool tip is displayed- Parameters:
tooltip-index-text-
-
verifyElementIsNotDisplayed
public static void verifyElementIsNotDisplayed(org.openqa.selenium.WebElement target)
verifies if element(s) is (are) not displayed- Parameters:
by-
-
verifyElementText
public static void verifyElementText(org.openqa.selenium.WebElement target, String value)verifies element text equals provided value- Parameters:
by-value-
-
verifyElementCount
public static void verifyElementCount(List<org.openqa.selenium.WebElement> target, int value, int... correction)
verifies element count- Parameters:
by-value-
-
verifyAnyTextContaining
public static void verifyAnyTextContaining(org.openqa.selenium.WebElement target, String... values)verifies if text contains any of values in list- Parameters:
target-values-
-
verifyAnyText
public static void verifyAnyText(org.openqa.selenium.WebElement target, String... values)verifies if text contains any of values in list- Parameters:
target-values-
-
setField
public static void setField(String value, List<org.openqa.selenium.WebElement> field, int index)
sets field text value by index hides keyboard if on ios device- Parameters:
value-field-index-
-
setField
public static void setField(org.openqa.selenium.WebElement field, CharSequence... value)set field value if value is not empty- Parameters:
field-value-
-
setFieldByAction
public static void setFieldByAction(List<org.openqa.selenium.WebElement> field, int index, CharSequence... value)
-
setFieldByAction
public static void setFieldByAction(org.openqa.selenium.WebElement field, CharSequence... value)
-
setFieldByJs
public static void setFieldByJs(List<org.openqa.selenium.WebElement> field, int index, CharSequence... value)
-
setFieldByJs
public static void setFieldByJs(org.openqa.selenium.WebElement field, CharSequence... value)
-
clearAndSetField
public static void clearAndSetField(org.openqa.selenium.WebElement field, CharSequence... value)sets field clears field before setting the value- Parameters:
field-value-
-
clearAndSetField
public static void clearAndSetField(List<org.openqa.selenium.WebElement> field, int index, CharSequence... value)
sets field clears field before setting the value- Parameters:
field-index-value-
-
setChildField
public static void setChildField(List<org.openqa.selenium.WebElement> parent, int parentIndex, List<org.openqa.selenium.WebElement> child, int childIndex, CharSequence... value)
sets key based on nested text field- Parameters:
parent-parentIndex-child-childIndex-value-
-
setFieldAndEnter
public static void setFieldAndEnter(org.openqa.selenium.WebElement field, CharSequence... value)sets field And presses the enter key- Parameters:
field-value-
-
setKey
public static void setKey(org.openqa.selenium.Keys key, org.openqa.selenium.WebElement field)send- Parameters:
key-field-
-
formSubmit
public static void formSubmit(org.openqa.selenium.WebElement button, org.openqa.selenium.WebElement expected)select submit button And wait for expected element to load- Parameters:
button-expected-
-
formSubmit
public static void formSubmit(org.openqa.selenium.WebElement button, org.openqa.selenium.WebElement expected, org.openqa.selenium.WebElement spinner)clicks submit button, wait for element to appear And loading spinner to be removed- Parameters:
button-expected-spinner-
-
selectDropDownWithDoubleClick
public static void selectDropDownWithDoubleClick(String option, org.openqa.selenium.WebElement field, List<org.openqa.selenium.WebElement> listValue)
selects dropdown by double clicking on the field- Parameters:
option-field-list-
-
selectDropDownWithDoubleClick
public static void selectDropDownWithDoubleClick(String option, org.openqa.selenium.WebElement field, int index, List<org.openqa.selenium.WebElement> listValue)
selects dropdown by double clicking on the field- Parameters:
option-field-list-
-
selectDropDown
public static void selectDropDown(org.openqa.selenium.WebElement field, String... options)selects drop down- Parameters:
option- : list option we want to selectfield- : the drop down field
-
selectDropDown
public static void selectDropDown(List<org.openqa.selenium.WebElement> field, int index)
selects drop down- Parameters:
option- : list option we want to selectfield- : the drop down field
-
selectDropDown
public static void selectDropDown(org.openqa.selenium.WebElement field, List<org.openqa.selenium.WebElement> list, String... options)selects drop down- Parameters:
option- : list option we want to selectfield- : the drop down fieldlist- : the list items in the drop down list
-
selectDropDown
@Deprecated public static void selectDropDown(String option, org.openqa.selenium.WebElement field, List<org.openqa.selenium.WebElement> listValue)
Deprecated.replaced by selectDropDown(field, list, options) selects drop down- Parameters:
option- : list option we want to selectfield- : the drop down fieldlist- : the list items in the drop down list
-
selectDropDown
public static void selectDropDown(String option, List<org.openqa.selenium.WebElement> field, String field_Identifier, List<org.openqa.selenium.WebElement> listValue)
selects drop down from list defined by another list defined by text- Parameters:
option-field-field_Identifier-list-
-
selectDropDown
public static void selectDropDown(int index, org.openqa.selenium.WebElement field, List<org.openqa.selenium.WebElement> listValue)select drop down by index from the drop down list- Parameters:
index-field-list-
-
selectDropDown
public static void selectDropDown(org.openqa.selenium.WebElement field, List<org.openqa.selenium.WebElement> item)select drop down using by value of the list item- Parameters:
index-field-list-
-
selectDropDown
public static void selectDropDown(String option, org.openqa.selenium.WebElement field, List<org.openqa.selenium.WebElement> listValue, int listIndex)
select drop down based on index of the drop down list eg. used for date selection where each date value: day, month, year, is separate list send key is used to select the value from the list- Parameters:
option-field-list-listIndex-
-
selectDropDown
public static void selectDropDown(String option, List<org.openqa.selenium.WebElement> field, int index, org.openqa.selenium.WebElement list, int listIndex)
select drop down based on index of the drop down list eg. used for date selection where each date value: day, month, year, is separate list send key is used to select the value from the list- Parameters:
option-field-index-list-listIndex-
-
selectDropDown
public static void selectDropDown(String option, List<org.openqa.selenium.WebElement> field, int index, org.openqa.selenium.WebElement listValue)
selects drop down based on index of the drop down field- Parameters:
option-field-index-list-
-
selectCheckBox
public static void selectCheckBox(org.openqa.selenium.WebElement button, boolean isSelect)selects checkbox based on by value- Parameters:
button-isSelect-
-
selectRadioButton
public static void selectRadioButton(String option, org.openqa.selenium.WebElement buttons)
selects radio button by radio button description- Parameters:
option-buttons-
-
selectRadioButton
public static void selectRadioButton(org.openqa.selenium.WebElement button)
selects a button- Parameters:
button-
-
selectMultipleCheckboxOptions
public static void selectMultipleCheckboxOptions(List<String> selections, org.openqa.selenium.WebElement checkboxes)
selects multiple checkbox options- Parameters:
selections-checkboxes-
-
uploadFile
public static void uploadFile(String location, org.openqa.selenium.WebElement imageButton)
uploads file by specifying file location relative to main path- Parameters:
location-imageButton-
-
uploadImages
public static void uploadImages(List<String> locations, org.openqa.selenium.WebElement imageButton, org.openqa.selenium.WebElement images)
sets the image based on location- Parameters:
location-imageButton-images- : uploaded image
-
uploadImage
public static void uploadImage(String location, org.openqa.selenium.WebElement imageButton, org.openqa.selenium.WebElement images)
sets the image based on location- Parameters:
location-imageButton-images- : uploaded image
-
getTextValue
public static String getTextValue(org.openqa.selenium.WebElement target)
gets the text value from an element- Parameters:
element-- Returns:
-
getTextValue
public static String getTextValue(org.openqa.selenium.WebElement target, int index)
gets the text value from an element- Parameters:
element-- Returns:
-
isElementEditable
public boolean isElementEditable(org.openqa.selenium.WebElement target)
attempts to set text value on element, if not successful, then element is not editable- Parameters:
element-index-- Returns:
-
isElementEditable
public boolean isElementEditable(org.openqa.selenium.WebElement target, int index)attempts to set text value on element, if not successful, then element is not editable- Parameters:
element-index-- Returns:
-
selectElementInList
public static void selectElementInList(List<org.openqa.selenium.WebElement> listValue, int index)
selects an element in list by its index value- Parameters:
list-index-
-
searchAndWaitForResults
public static void searchAndWaitForResults(String searchQuery, org.openqa.selenium.WebElement target, org.openqa.selenium.WebElement spinner)
enters value into the search field And selects enter waits for the loading spinner to be removed- Parameters:
searchQuery-byTarget-spinner-
-
selectListItemEqualsByName
public static void selectListItemEqualsByName(List<org.openqa.selenium.WebElement> listValue, String option)
selects list item by the string option provided- Parameters:
list-option-
-
selectListItemEqualsByName
public static void selectListItemEqualsByName(List<org.openqa.selenium.WebElement> listValue, String option, org.openqa.selenium.WebElement target)
finds target element which is in the same container And has the same index as the parent eg. delete button in the list of customers, both having index 2. we find the index by name, And use that to find the target element- Parameters:
list-option-target-
-
selectListItemContainsByName
public static void selectListItemContainsByName(List<org.openqa.selenium.WebElement> listValue, String option, org.openqa.selenium.WebElement target)
selects list item containing string eg. a list of athletes names containing a delete button- Parameters:
list-option-target-
-
getElementIndexInList
public static int getElementIndexInList(List<org.openqa.selenium.WebElement> srcList, org.openqa.selenium.WebElement target)
find the index of the target element in list eg. list A, 5 rows, has element B in row 2. therefore, index 1 is returned @param list- Parameters:
list-target-- Returns:
- index of element in list
-
getRowValuesFromList
public List<String> getRowValuesFromList(List<org.openqa.selenium.WebElement> srcList, int index, org.openqa.selenium.WebElement rows)
returns the list of string values for a row of elements- Parameters:
list-index-rows-- Returns:
-
selectElementContainedInList
public static void selectElementContainedInList(List<org.openqa.selenium.WebElement> listValue, String option, org.openqa.selenium.WebElement target, int targetIndex)
Selects list item from a parent container eg. delete button in a list defined by name find the container containing the name And Then finds the delete button in that container as target- Parameters:
list-option-target-
-
selectElementContainedInList
public static void selectElementContainedInList(List<org.openqa.selenium.WebElement> listValue, String option, org.openqa.selenium.WebElement target)
Selects list item from a parent container eg. delete button in a list defined by name find the container containing the name And Then finds the delete button in that container as target- Parameters:
list-option-target-
-
selectListItemContainsByName
public static void selectListItemContainsByName(List<org.openqa.selenium.WebElement> listValue, String option)
finds target element which is in the same container And has the same index as the parent eg. delete button in the list of customers, both having index 2. we find the index containing name, And use that to find the target element- Parameters:
list-option-
-
selectListItemByIndex
public static void selectListItemByIndex(List<org.openqa.selenium.WebElement> listValue, int index)
selects list item by the string option provided- Parameters:
list-option-
-
getListCount
public static int getListCount(List<org.openqa.selenium.WebElement> listValue)
returns the number of elements in list- Parameters:
list-- Returns:
-
getElementIndexEqualsByText
public static int getElementIndexEqualsByText(List<org.openqa.selenium.WebElement> listValue, String option)
returns the index of text value in a list- Parameters:
list-option-- Returns:
-
getElementIndexContainByText
public static int getElementIndexContainByText(List<org.openqa.selenium.WebElement> listValue, String option)
retuns index of element in list which contains in text- Parameters:
list-option-- Returns:
-
getStringIndexContainByText
public static int getStringIndexContainByText(List<String> stringList, String option)
returns the index of string value in list of strings- Parameters:
stringList- normalizedoption- normalized- Returns:
-
verifyContainsIsInList
public static void verifyContainsIsInList(List<org.openqa.selenium.WebElement> listValue, String option)
verifies if option value is in the list index = -1 indicates the value is not in list- Parameters:
list-option-
-
verifyIsInList
public static void verifyIsInList(List<org.openqa.selenium.WebElement> listValue, String option)
verifies if option value is in the list index = -1 indicates the value is not in list- Parameters:
list-option-
-
verifyIsInList
public static void verifyIsInList(List<org.openqa.selenium.WebElement> listValue, String indicator, String option)
verify text option in list based on key value in the list- Parameters:
list-indicator-option-
-
isContainedInList
public static boolean isContainedInList(List<org.openqa.selenium.WebElement> listValue, String option)
return if element is contained in list- Parameters:
list-option-- Returns:
-
isExactMatchInList
public static boolean isExactMatchInList(List<org.openqa.selenium.WebElement> listValue, String option)
return if element is an exact match in list- Parameters:
list-option-- Returns:
-
getListValues
public static List<String> getListValues(List<org.openqa.selenium.WebElement> listValue)
returns the list of values in a list- Parameters:
list-- Returns:
-
getTextList
public static List<String> getTextList(List<org.openqa.selenium.WebElement> listValue)
returns the list of values in a list- Parameters:
list-- Returns:
-
mobile_swipeRight
public void mobile_swipeRight(List<org.openqa.selenium.WebElement> elements, int index, double durationInSeconds)
swipe right on the screen based on element position
-
mobile_swipeLeft
public void mobile_swipeLeft(List<org.openqa.selenium.WebElement> elements, int index, double durationInSeconds)
swipe left on the screen based on element position
-
mobile_swipeUp
public void mobile_swipeUp(List<org.openqa.selenium.WebElement> elements, int index, double durationInSeconds)
swipe up on the screen based on element position
-
mobile_swipeDown
public void mobile_swipeDown(List<org.openqa.selenium.WebElement> elements, int index, double durationInSeconds)
swipe down on the screen based on element position
-
mobile_longPress
public static void mobile_longPress(org.openqa.selenium.WebElement target, long miliSeconds)press per retry presses the target element- Parameters:
target-index-miliSeconds-expected-
-
mobile_longPressAndExpect
public static void mobile_longPressAndExpect(org.openqa.selenium.WebElement target, long miliSeconds, org.openqa.selenium.WebElement expected)long press And expect element- Parameters:
target-miliSeconds-expected-
-
mobile_zoomOut
public static void mobile_zoomOut(org.openqa.selenium.WebElement indicator)
zooms out And checks if target level indicator has been reached- Parameters:
zoomLevel-indicator-
-
mobile_zoomIn
public static void mobile_zoomIn(org.openqa.selenium.WebElement indicator)
zooms in And checks if target level indicator has been reached- Parameters:
zoomLevel-indicator-
-
mobile_scrollToElement
public static void mobile_scrollToElement(org.openqa.selenium.WebElement target)
scrolls to mobile element until element is becomes visible- Parameters:
target-
-
switchIframe
public static void switchIframe(org.openqa.selenium.WebElement frame)
switches frame to frame specified- Parameters:
frame-
-
isVisibleInViewport
public static Boolean isVisibleInViewport(List<org.openqa.selenium.WebElement> elements, int index)
returns true if the element is visible in the current page only for web applications- Parameters:
by-- Returns:
-
scrollToWebElement
public static void scrollToWebElement(org.openqa.selenium.WebElement element)
scroll to web element- Parameters:
element-
-
scrollToWebElement
public static void scrollToWebElement(List<org.openqa.selenium.WebElement> elements, int index)
scroll to element- Parameters:
element-index-
-
isVisibleInViewport
public static Boolean isVisibleInViewport(org.openqa.selenium.WebElement element)
returns true if the element is visible in the current page only for web applications- Parameters:
by-- Returns:
-
getAttribute
public static String getAttribute(org.openqa.selenium.WebElement byValue, String attribute)
gets specified attribute of the element- Parameters:
byValue-index-attribute-
-
isElementContainingClass
public static boolean isElementContainingClass(org.openqa.selenium.WebElement element, String classValue)returns true if element contains class value- Parameters:
by-classValue-- Returns:
-
isAttributeContaining
public static boolean isAttributeContaining(org.openqa.selenium.WebElement element, String attribute, String value)returns true if element contains attribute value- Parameters:
by-classValue-- Returns:
-
getAttribute
public static String getAttribute(List<org.openqa.selenium.WebElement> elements, int index, String attribute)
gets specified attribute of the element based on index- Parameters:
byValue-index-attribute-
-
setAttribute
public static void setAttribute(org.openqa.selenium.WebElement element, String attribute, String value)sets attribute value of an element- Parameters:
by-attribute-value-
-
setAttribute
public static void setAttribute(List<org.openqa.selenium.WebElement> elements, int index, String attribute, String value)
sets attribute value of an element- Parameters:
by-index-attribute-value-
-
getElementSize
public static org.openqa.selenium.Dimension getElementSize(org.openqa.selenium.WebElement element)
returns element dimension- Parameters:
by-- Returns:
-
getElementPosition
public static org.openqa.selenium.Point getElementPosition(org.openqa.selenium.WebElement element)
get element position on display- Parameters:
by-- Returns:
-
getElementPosition
public static org.openqa.selenium.Point getElementPosition(List<org.openqa.selenium.WebElement> elements, int index)
get element position on display- Parameters:
by-index-- Returns:
-
findElementCoordinates
public static int[] findElementCoordinates(org.openqa.selenium.WebElement target)
returns the center coordinates of the target element- Parameters:
target-- Returns:
-
findMiddleOfElement
public static int[] findMiddleOfElement(org.openqa.selenium.WebElement target)
returns the center coordinates of the target element- Parameters:
target-- Returns:
-
waitForElementToLoad
public static void waitForElementToLoad(org.openqa.selenium.WebElement target)
waits for element to be displayed for amount of time specified by 60 seconds- Parameters:
target-
-
waitForElementToLoad
public static boolean waitForElementToLoad(org.openqa.selenium.WebElement target, int time)waits for element to load count() checks if the element is displayed Then gets the count number- Parameters:
target-time-
-
waitForFirstElementToLoad
public static boolean waitForFirstElementToLoad(org.openqa.selenium.WebElement element1, org.openqa.selenium.WebElement element2, org.openqa.selenium.WebElement element3)waits for either element to load returns true When first item loads- Parameters:
element1-element2-time-- Returns:
-
waitForFirstElementToLoad
public static boolean waitForFirstElementToLoad(org.openqa.selenium.WebElement element1, org.openqa.selenium.WebElement element2, org.openqa.selenium.WebElement element3, int time)waits for either element to load returns true When first item loads- Parameters:
element1-element2-time-- Returns:
-
waitForFirstElementToLoad
public static boolean waitForFirstElementToLoad(org.openqa.selenium.WebElement element1, org.openqa.selenium.WebElement element2, int time)waits for either element to load returns true When first item loads- Parameters:
element1-element2-time-- Returns:
-
waitForFirstElementToLoad
public static boolean waitForFirstElementToLoad(org.openqa.selenium.WebElement element1, org.openqa.selenium.WebElement element2)waits for either element to load returns true When first item loads- Parameters:
element1-element2-time-- Returns:
-
mobile_waitAndRefreshForElementToLoad
public static void mobile_waitAndRefreshForElementToLoad(org.openqa.selenium.WebElement target, int time)waits for element to load And refreshes the app each time to renew the dom- Parameters:
target-
-
mobile_waitAndRefreshForElementToLoad
public static void mobile_waitAndRefreshForElementToLoad(org.openqa.selenium.WebElement target)
waits for element to load And refreshes the app each time to renew the dom- Parameters:
target-
-
waitForElementToLoad
public static boolean waitForElementToLoad(org.openqa.selenium.WebElement target, int time, int count)waits for element to load If mobile device, scrolls down the page until element is visible- Parameters:
target- : element to wait fortime- : max time to waitcount- : minimum count of elements to wait for in list- Returns:
-
waitForAdditionalElementsToLoad
public static void waitForAdditionalElementsToLoad(org.openqa.selenium.WebElement target, int originalCount)waits for element count to increase from the originalCount Usefull When waiting for a list to expand with additional items- Parameters:
target-originalCount-
-
waitForAdditionalElementsToLoad
public static void waitForAdditionalElementsToLoad(org.openqa.selenium.WebElement target, int originalCount, int time)waits for element count to increase from the originalCount Usefull When waiting for a list to expand with additional items- Parameters:
target-originalCount-
-
waitForElementToBeRemoved
public static boolean waitForElementToBeRemoved(org.openqa.selenium.WebElement target)
waits for element to not be displayed wait for maximum of 60 seconds- Parameters:
target-- Returns:
-
waitForElementToBeRemoved
public static boolean waitForElementToBeRemoved(org.openqa.selenium.WebElement target, int time)waits for element to not be displayed- Parameters:
target-time- : maximum amount of time in seconds to wait
-
waitForElementToBeRemoved
public static boolean waitForElementToBeRemoved(org.openqa.selenium.WebElement target, int time, int waitForTargetToLoadInSeconds)waits for element to not be displayed- Parameters:
target-time- : maximum amount of time in seconds to wait. use AbstractDriver.TIMEOUT_SECONDS for default timeoutwaitForTargetToLoadInSeconds- wait for element to load before waiting for element to be removed
-
waitForListItemToLoad_Contains
public static void waitForListItemToLoad_Contains(org.openqa.selenium.WebElement list, String option)waits for item containing in list to load- Parameters:
list-option-time-
-
waitForTextToLoad
public static void waitForTextToLoad(org.openqa.selenium.WebElement target, String text)waits for text to be loaded for amount of time specified by 60 seconds- Parameters:
target-
-
waitForTextToLoad
public static void waitForTextToLoad(org.openqa.selenium.WebElement target, int time, String text)make sure only one element And caller needs to take responsibility to have text in the element- Parameters:
target-time-
-
waitForElementToBeClickable
public static boolean waitForElementToBeClickable(org.openqa.selenium.WebElement selector)
wait for element to become clickable causes instability with hybrid mobile app- Parameters:
selector-- Returns:
-
waitForElementToBeClickable
public static boolean waitForElementToBeClickable(org.openqa.selenium.WebElement selector, int timeInSeconds)wait for element to become clickable causes instability with hybrid mobile app- Parameters:
selector-- Returns:
-
waitForClassContain
public boolean waitForClassContain(List<org.openqa.selenium.WebElement> elements, int index, String value)
wait for class to contain- Parameters:
target-index-value-- Returns:
-
waitForClassContain
public boolean waitForClassContain(org.openqa.selenium.WebElement target, int index, String value, int time)wait for class to contain value- Parameters:
target-index-value-time-- Returns:
-
waitForAnyTextToLoadContaining
public static boolean waitForAnyTextToLoadContaining(org.openqa.selenium.WebElement target, String... text)wait for any text strings to become available- Parameters:
target-time-text-- Returns:
-
waitForAnyTextToLoadContaining
public static boolean waitForAnyTextToLoadContaining(org.openqa.selenium.WebElement target, int time, String... text)wait for any text strings to become available- Parameters:
target-time-text-- Returns:
-
waitForAnyTextToLoad
public static boolean waitForAnyTextToLoad(org.openqa.selenium.WebElement target, String... text)wait for any text strings to become available- Parameters:
target-time-text-- Returns:
-
waitForAnyTextToLoad
public static boolean waitForAnyTextToLoad(List<org.openqa.selenium.WebElement> elements, int time, String... text)
wait for any text strings to become available- Parameters:
target-time-text-- Returns:
-
highLightWebElement
public static void highLightWebElement(List<org.openqa.selenium.WebElement> elements, int index)
highlights the web element use on clicks and send key elements- Parameters:
by-index-
-
hoverBy
public static void hoverBy(org.openqa.selenium.WebElement element)
hover over element- Parameters:
by-
-
hoverBy
public static void hoverBy(List<org.openqa.selenium.WebElement> elements, int index)
hover over element- Parameters:
by-
-
inputTextByAction
public void inputTextByAction(org.openqa.selenium.WebElement element, String text)
-
doubleClickBy
public static void doubleClickBy(org.openqa.selenium.WebElement element)
-
moveToElement
public static void moveToElement(List<org.openqa.selenium.WebElement> targets, int index)
move to element by using action- Parameters:
target-index-
-
moveToElement
public static void moveToElement(List<org.openqa.selenium.WebElement> targets, int index, int xOffset, int yOffset)
move to element by using action- Parameters:
target-index-
-
assertTrue
public static void assertTrue(String message, boolean value)
assert true- Parameters:
message- if failvalue-
-
assertFalse
public static void assertFalse(String message)
-
assertEquals
public static void assertEquals(String expected, String actual)
assert expected equals actual- Parameters:
expected-actual-
-
assertEquals
public static void assertEquals(boolean expected, boolean actual)assert expected equals actual- Parameters:
expected-actual-
-
assertEquals
public static void assertEquals(int expected, int actual)assert expected equals actual- Parameters:
expected-actual-
-
assertContains
public static void assertContains(String expected, String actual)
assert actual contains expected- Parameters:
actual-expected-
-
softAssertTrue
public static void softAssertTrue(String message, boolean value)
-
softAssertEqual
public static void softAssertEqual(int expected, int actual)
-
softAssert
public static org.testng.asserts.SoftAssert softAssert()
-
softAssertAll
public static void softAssertAll()
-
logStackTrace
public static void logStackTrace(AssertionError e)
-
logStackTrace
public static void logStackTrace(Exception e)
-
byCss
public static EnhancedBy byCss(String element, String name)
gets element by css value- Parameters:
element-name-- Returns:
-
byId
public static EnhancedBy byId(String element, String name)
gets element by id- Parameters:
element-name-- Returns:
-
byXpath
public static EnhancedBy byXpath(String element, String name)
gets element by xpath- Parameters:
element-name-- Returns:
-
byAccessibility
public static EnhancedBy byAccessibility(String element, String name)
gets element by accessibility id- Parameters:
element-name-- Returns:
-
clickAndExpect
public static void clickAndExpect(EnhancedBy target, EnhancedBy expected)
clicks target And waits for expected element to display retries 10 times- Parameters:
target-expected-
-
clickAndExpect
public static void clickAndExpect(EnhancedBy target, String text, EnhancedBy expected)
click And expect based on the text value on the element. eg. button with "OK" text- Parameters:
target-text-expected-
-
clickAndExpectContainsByText
public void clickAndExpectContainsByText(EnhancedBy target, String text, EnhancedBy expected)
click And expect based on the text value on the element. eg. button with "OK" text- Overrides:
clickAndExpectContainsByTextin classHelper- Parameters:
target-text-expected-
-
clickAndExpect
public static void clickAndExpect(EnhancedBy target, EnhancedBy expected, boolean isMobileRefresh)
clicks target And waits for expected element to display retries 10 times- Parameters:
target-expected-
-
clickAndExpect
public static void clickAndExpect(EnhancedBy target, int index, EnhancedBy expected1, EnhancedBy expected2)
clicks target And wait for one the 2 expected elements to appear- Parameters:
target-index-expected1-expected2-
-
clickAndExpect
public static void clickAndExpect(EnhancedBy target, int index, EnhancedBy expected)
clicks element based on index And waits for expected element to be displayed- Parameters:
target-index-expected-
-
clickAndExpect
public static void clickAndExpect(EnhancedBy target, EnhancedBy expected, EnhancedBy spinner)
clicks target And waits for expected element to show up also waits for spinner element to be removed from display- Parameters:
target-expected-spinner-
-
clickAndNotExpect
public static void clickAndNotExpect(EnhancedBy target, EnhancedBy expected)
clicks target And waits for expected to not be displayed retries 10 times- Parameters:
target-expected-
-
clickAndWait
public static void clickAndWait(EnhancedBy target, double timeInSeconds)
clicks target And waits for seconds- Parameters:
target-expected-
-
clickAndWait
public static void clickAndWait(EnhancedBy target, int index, double timeInSeconds)
clicks target And waits for seconds- Parameters:
target-expected-
-
clickAndNotExpect
public static void clickAndNotExpect(EnhancedBy target, int index, EnhancedBy expected)
-
clickElementLocationBy
public static void clickElementLocationBy(EnhancedBy by, int x, int y)
Click on an element's specific x,y location- Parameters:
by- by elementx- x offset coordinatey- y offset coordinate
-
clickPoints
public static void clickPoints(int x, int y)click at position x, y- Parameters:
x-y-
-
clickPointsAndExpect
public static void clickPointsAndExpect(int x, int y, EnhancedBy expected)click point at x,y coordinates and expect and element to be present retry every 5 seconds for duration of explicit timeout- Parameters:
x-y-expected-
-
doubleClickPoints
public static void doubleClickPoints(int x, int y)double click at position- Parameters:
x-y-
-
doubleClick
public static void doubleClick(EnhancedBy target, int index)
double click on element- Parameters:
target-index-
-
rightClick
public static void rightClick(EnhancedBy target, int index)
right click on element at index- Parameters:
target-index-
-
clickElementContinsByText
public static void clickElementContinsByText(EnhancedBy by, String text)
click element with text containing- Parameters:
by-text-
-
clickAndHold
public static void clickAndHold(EnhancedBy target, double seconds)
click And hold element- Parameters:
target-seconds-
-
clickAndHold
public static void clickAndHold(EnhancedBy target, int index, double seconds)
click And hold based on element index- Parameters:
target-index-seconds-
-
dragAndDrop
public static void dragAndDrop(EnhancedBy src, EnhancedBy target)
drag And drop from src element to target element- Parameters:
src-target-
-
dragAndDrop
public void dragAndDrop(EnhancedBy srcParent, int srcParentIndex, EnhancedBy srcChild, int scrChildIndex, EnhancedBy targetParent, int targeParenttIndex, EnhancedBy targetChild, int targetChildIndex)
drag And drop from src element to target element- Overrides:
dragAndDropin classHelper- Parameters:
src-target-
-
dragAndDrop
public static void dragAndDrop(EnhancedBy src, int xOffset, int yOffset)
drag And drop from src element to target element- Parameters:
src-target-
-
verifyElementIsDisplayed
public static void verifyElementIsDisplayed(EnhancedBy by)
verifies if element(s) is (are) displayed- Parameters:
by-
-
isDisplayed
public static boolean isDisplayed(EnhancedBy element)
returns true if element is displayed- Parameters:
element-- Returns:
-
isPresent
public static boolean isPresent(EnhancedBy element)
returns true if element is displayed- Parameters:
element-- Returns:
-
isElementContainingText
public static boolean isElementContainingText(EnhancedBy element, String text)
returns true if element contains text- Parameters:
element-text-- Returns:
-
verifyElementContainingText
public static void verifyElementContainingText(EnhancedBy element, String text)
verify if element contains text- Parameters:
element-text-
-
verifyTextDisplayed
public static void verifyTextDisplayed(String text)
verify if text is displayed on page- Parameters:
text-
-
isTextDisplayed
public static boolean isTextDisplayed(String text)
is text displayed on page- Parameters:
text-- Returns:
-
verifyToolTip
public void verifyToolTip(EnhancedBy tooltip, int index, String text)
verify tool tip is displayed- Overrides:
verifyToolTipin classHelper- Parameters:
tooltip-index-text-
-
verifyElementIsNotDisplayed
public static void verifyElementIsNotDisplayed(EnhancedBy by)
verifies if element(s) is (are) not displayed- Parameters:
by-
-
verifyElementText
public static void verifyElementText(EnhancedBy by, String value)
verifies element text equals provided value- Parameters:
by-value-
-
verifyElementCount
public static void verifyElementCount(EnhancedBy by, int value, int... correction)
verifies element count- Parameters:
by-value-
-
verifyAnyTextContaining
public static void verifyAnyTextContaining(EnhancedBy target, String... values)
verifies if text contains any of values in list- Parameters:
target-values-
-
verifyAnyText
public static void verifyAnyText(EnhancedBy target, String... values)
verifies if text contains any of values in list- Parameters:
target-values-
-
setField
public static void setField(String value, EnhancedBy field, int index)
sets field text value by index hides keyboard if on ios device- Parameters:
value-field-index-
-
setField
public static void setField(EnhancedBy field, CharSequence... value)
set field value if value is not empty- Parameters:
field-value-
-
setFieldByAction
public static void setFieldByAction(EnhancedBy field, int index, CharSequence... value)
-
setFieldByAction
public static void setFieldByAction(EnhancedBy field, CharSequence... value)
-
setFieldByJs
public static void setFieldByJs(EnhancedBy field, int index, CharSequence... value)
-
setFieldByJs
public static void setFieldByJs(EnhancedBy field, CharSequence... value)
-
clearAndSetField
public static void clearAndSetField(EnhancedBy field, CharSequence... value)
sets field clears field before setting the value- Parameters:
field-value-
-
clearAndSetField
public static void clearAndSetField(EnhancedBy field, int index, CharSequence... value)
sets field clears field before setting the value- Parameters:
field-index-value-
-
setChildField
public static void setChildField(EnhancedBy parent, int parentIndex, EnhancedBy child, int childIndex, CharSequence... value)
sets key based on nested text field- Parameters:
parent-parentIndex-child-childIndex-value-
-
setFieldAndEnter
public static void setFieldAndEnter(EnhancedBy field, CharSequence... value)
sets field And presses the enter key- Parameters:
field-value-
-
setKey
public static void setKey(org.openqa.selenium.Keys key, EnhancedBy field)send- Parameters:
key-field-
-
formSubmit
public static void formSubmit(EnhancedBy button, EnhancedBy expected)
select submit button And wait for expected element to load- Parameters:
button-expected-
-
formSubmit
public static void formSubmit(EnhancedBy button, EnhancedBy expected, EnhancedBy spinner)
clicks submit button, wait for element to appear And loading spinner to be removed- Parameters:
button-expected-spinner-
-
selectDropDownWithDoubleClick
public static void selectDropDownWithDoubleClick(String option, EnhancedBy field, EnhancedBy listValue)
selects dropdown by double clicking on the field- Parameters:
option-field-list-
-
selectDropDownWithDoubleClick
public static void selectDropDownWithDoubleClick(String option, EnhancedBy field, int index, EnhancedBy listValue)
selects dropdown by double clicking on the field- Parameters:
option-field-list-
-
selectDropDown
public static void selectDropDown(EnhancedBy field, EnhancedBy list, String... options)
selects drop down- Parameters:
option- : list option we want to selectfield- : the drop down fieldlist- : the list items in the drop down list
-
selectDropDown
@Deprecated public static void selectDropDown(String option, EnhancedBy field, EnhancedBy listValue)
Deprecated.replaced by selectDropDown(field, list, options) selects drop down- Parameters:
option- : list option we want to selectfield- : the drop down fieldlist- : the list items in the drop down list
-
selectDropDown
public static void selectDropDown(String option, EnhancedBy field, String field_Identifier, EnhancedBy listValue)
selects drop down from list defined by another list defined by text- Parameters:
option-field-field_Identifier-list-
-
selectDropDown
public static void selectDropDown(int index, EnhancedBy field, EnhancedBy listValue)select drop down by index from the drop down list- Parameters:
index-field-list-
-
selectDropDown
public static void selectDropDown(EnhancedBy field, EnhancedBy item)
select drop down using by value of the list item- Parameters:
index-field-list-
-
selectDropDown
public static void selectDropDown(String option, EnhancedBy field, EnhancedBy listValue, int listIndex)
select drop down based on index of the drop down list eg. used for date selection where each date value: day, month, year, is separate list send key is used to select the value from the list- Parameters:
option-field-list-listIndex-
-
selectDropDown
public static void selectDropDown(String option, EnhancedBy field, int index, EnhancedBy list, int listIndex)
select drop down based on index of the drop down list eg. used for date selection where each date value: day, month, year, is separate list send key is used to select the value from the list- Parameters:
option-field-index-list-listIndex-
-
selectDropDown
public static void selectDropDown(String option, EnhancedBy field, int index, EnhancedBy listValue)
selects drop down based on index of the drop down field- Parameters:
option-field-index-list-
-
selectCheckBox
public static void selectCheckBox(EnhancedBy button, boolean isSelect)
selects checkbox based on by value- Parameters:
button-isSelect-
-
selectRadioButton
public static void selectRadioButton(String option, EnhancedBy buttons)
selects radio button by radio button description- Parameters:
option-buttons-
-
selectRadioButton
public static void selectRadioButton(EnhancedBy button)
selects a button- Parameters:
button-
-
selectMultipleCheckboxOptions
public static void selectMultipleCheckboxOptions(List<String> selections, EnhancedBy checkboxes)
selects multiple checkbox options- Parameters:
selections-checkboxes-
-
uploadFile
public static void uploadFile(String location, EnhancedBy imageButton)
uploads file by specifying file location relative to main path- Parameters:
location-imageButton-
-
uploadImages
public static void uploadImages(List<String> locations, EnhancedBy imageButton, EnhancedBy images)
sets the image based on location- Parameters:
location-imageButton-images- : uploaded image
-
uploadImage
public static void uploadImage(String location, EnhancedBy imageButton, EnhancedBy images)
sets the image based on location- Parameters:
location-imageButton-images- : uploaded image
-
getTextValue
public static String getTextValue(EnhancedBy element)
gets the text value from an element- Parameters:
element-- Returns:
-
getTextValue
public static String getTextValue(EnhancedBy element, int index)
gets the text value from an element- Parameters:
element-- Returns:
-
isElementEditable
public boolean isElementEditable(EnhancedBy element)
attempts to set text value on element, if not successful, then element is not editable- Overrides:
isElementEditablein classHelper- Parameters:
element-index-- Returns:
-
isElementEditable
public boolean isElementEditable(EnhancedBy element, int index)
attempts to set text value on element, if not successful, then element is not editable- Overrides:
isElementEditablein classHelper- Parameters:
element-index-- Returns:
-
selectElementInList
public static void selectElementInList(EnhancedBy listValue, int index)
selects an element in list by its index value- Parameters:
list-index-
-
selectElementInList
public static void selectElementInList(EnhancedBy listValue, int index, EnhancedBy expected)
selects an element in list by its index value And waits for expected element- Parameters:
list-index-expected-
-
searchAndWaitForResults
public static void searchAndWaitForResults(String searchQuery, EnhancedBy byTarget, EnhancedBy spinner)
enters value into the search field And selects enter waits for the loading spinner to be removed- Parameters:
searchQuery-byTarget-spinner-
-
selectListItemEqualsByName
public static void selectListItemEqualsByName(EnhancedBy listValue, String option)
selects list item by the string option provided- Parameters:
list-option-
-
selectListItemEqualsByName
public static void selectListItemEqualsByName(EnhancedBy listValue, String option, EnhancedBy target)
finds target element which is in the same container And has the same index as the parent eg. delete button in the list of customers, both having index 2. we find the index by name, And use that to find the target element- Parameters:
list-option-target-
-
selectListItemContainsByName
public static void selectListItemContainsByName(EnhancedBy listValue, String option, EnhancedBy target)
selects list item containing string eg. a list of athletes names containing a delete button- Parameters:
list-option-target-
-
getElementIndexInList
public static int getElementIndexInList(EnhancedBy srcList, EnhancedBy target)
find the index of the target element in list eg. list A, 5 rows, has element B in row 2. therefore, index 1 is returned @param list- Parameters:
list-target-- Returns:
- index of element in list
-
getRowValuesFromList
public List<String> getRowValuesFromList(EnhancedBy srclist, int index, EnhancedBy rows)
returns the list of string values for a row of elements- Overrides:
getRowValuesFromListin classHelper- Parameters:
list-index-rows-- Returns:
-
getTableMap
public HashMap<String,List<String>> getTableMap(EnhancedBy columns, EnhancedBy dataRows, EnhancedBy dataCells)
gets hashmap representation of data column with row values- Overrides:
getTableMapin classHelper- Parameters:
columns-dataRows-- Returns:
-
getTableMap
public HashMap<String,List<String>> getTableMap(EnhancedBy columns, EnhancedBy dataRows, EnhancedBy dataCells, int maxRows)
gets hashmap representation of data column with row values- Overrides:
getTableMapin classHelper- Parameters:
columns-dataRows-dataCells-maxRows-- Returns:
-
getTableMap
public HashMap<String,List<String>> getTableMap(EnhancedBy columns, int columnInitialIndex, EnhancedBy dataRows, int rowInitialIndex, EnhancedBy dataCells, int maxRows)
gets hashmap representation of data column with row values- Overrides:
getTableMapin classHelper- Parameters:
columns-columnInitialIndex-dataRows-rowInitialIndex-dataCells-maxRows-- Returns:
-
selectElementContainedInList
public static void selectElementContainedInList(EnhancedBy listValue, String option, EnhancedBy target, int targetIndex)
Selects list item from a parent container eg. delete button in a list defined by name find the container containing the name And Then finds the delete button in that container as target- Parameters:
list-option-target-
-
selectElementContainedInList
public static void selectElementContainedInList(EnhancedBy listValue, String option, EnhancedBy target)
Selects list item from a parent container eg. delete button in a list defined by name find the container containing the name And Then finds the delete button in that container as target- Parameters:
list-option-target-
-
selectListItemContainsByName
public static void selectListItemContainsByName(EnhancedBy listValue, String option)
finds target element which is in the same container And has the same index as the parent eg. delete button in the list of customers, both having index 2. we find the index containing name, And use that to find the target element- Parameters:
list-option-
-
selectListItemByIndex
public static void selectListItemByIndex(EnhancedBy listValue, int index)
selects list item by the string option provided- Parameters:
list-option-
-
getListCount
public static int getListCount(EnhancedBy listValue)
returns the number of elements in list- Parameters:
list-- Returns:
-
getElementIndexEqualsByText
public static int getElementIndexEqualsByText(EnhancedBy listValue, String option)
returns the index of text value in a list- Parameters:
list-option-- Returns:
-
getElementIndexContainByText
public static int getElementIndexContainByText(EnhancedBy listValue, String option)
retuns index of element in list which contains in text- Parameters:
list-option-- Returns:
-
getStringIndexEqualsByText
public static int getStringIndexEqualsByText(List<String> stringList, String option)
returns the index of string value in list of strings- Parameters:
stringList- normalizedoption- normalized- Returns:
-
verifyContainsIsInList
public static void verifyContainsIsInList(EnhancedBy listValue, String option)
verifies if option value is in the list index = -1 indicates the value is not in list- Parameters:
list-option-
-
verifyIsInList
public static void verifyIsInList(EnhancedBy listValue, String option)
verifies if option value is in the list index = -1 indicates the value is not in list- Parameters:
list-option-
-
verifyIsInList
public static void verifyIsInList(EnhancedBy listValue, String indicator, String option)
verify text option in list based on key value in the list- Parameters:
list-indicator-option-
-
isContainedInList
public static boolean isContainedInList(EnhancedBy listValue, String option)
return if element is contained in list- Parameters:
list-option-- Returns:
-
isExactMatchInList
public static boolean isExactMatchInList(EnhancedBy listValue, String option)
return if element is an exact match in list- Parameters:
list-option-- Returns:
-
getListValues
public static List<String> getListValues(EnhancedBy listValue)
returns the list of values in a list- Parameters:
list-- Returns:
-
getTextList
public static List<String> getTextList(EnhancedBy listValue)
returns the list of values in a list- Parameters:
list-- Returns:
-
getAndroidDriver
public static io.appium.java_client.android.AndroidDriver getAndroidDriver()
-
getiOSDriver
public static io.appium.java_client.ios.IOSDriver getiOSDriver()
-
mobile_hideKeyboard
public static void mobile_hideKeyboard()
hides ios or android keyboard
-
pressEnterOnAndroid
public static void pressEnterOnAndroid()
select enter on android
-
mobile_resetApp
public static void mobile_resetApp()
resets the app
-
refreshMobileApp
public static void refreshMobileApp()
places the app in background And Then relaunches it
-
mobile_isMobile
public static boolean mobile_isMobile()
returns if mobile driver is used- Returns:
-
isInternetExplorer
public static boolean isInternetExplorer()
returns true if browser is ie- Returns:
-
isIOS
public static boolean isIOS()
is ios driver- Returns:
-
isAndroid
public static boolean isAndroid()
is android driver- Returns:
-
isWebDriver
public static boolean isWebDriver()
is web driver- Returns:
-
mobile_setLocation
public static void mobile_setLocation(org.openqa.selenium.html5.Location location)
sets gps location on ios simulator- Parameters:
location-
-
mobile_swipeRight
public void mobile_swipeRight(double durationInSeconds)
swipe right on the screen- Overrides:
mobile_swipeRightin classHelper
-
mobile_swipeRight
public void mobile_swipeRight(EnhancedBy element, int index, double durationInSeconds)
swipe right on the screen based on element position- Overrides:
mobile_swipeRightin classHelper
-
mobile_swipeLeft
public void mobile_swipeLeft(double durationInSeconds)
swipe right on the screen- Overrides:
mobile_swipeLeftin classHelper
-
mobile_swipeLeft
public void mobile_swipeLeft(EnhancedBy element, int index, double durationInSeconds)
swipe left on the screen based on element position- Overrides:
mobile_swipeLeftin classHelper
-
mobile_swipeUp
public void mobile_swipeUp(EnhancedBy element, int index, double durationInSeconds)
swipe up on the screen based on element position- Overrides:
mobile_swipeUpin classHelper
-
mobile_swipeUp
public void mobile_swipeUp(double durationInSeconds)
swipe up on the screen- Overrides:
mobile_swipeUpin classHelper
-
mobile_swipeDown
public void mobile_swipeDown(double durationInSeconds)
swipe down on the screen- Overrides:
mobile_swipeDownin classHelper
-
mobile_swipeDown
public void mobile_swipeDown(EnhancedBy element, int index, double durationInSeconds)
swipe down on the screen based on element position- Overrides:
mobile_swipeDownin classHelper
-
mobile_switchToNativeView
public static void mobile_switchToNativeView()
sets native context for android And ios apps- Parameters:
context-
-
mobile_switchToWebView
public static void mobile_switchToWebView()
sets web context for android And ios apps- Parameters:
context-
-
mobile_switchToView
public void mobile_switchToView(String view)
switch to view- Overrides:
mobile_switchToViewin classHelper- Parameters:
view-
-
mobile_getContextList
public Set<String> mobile_getContextList()
returns the list of mobile context. eg. webview, native view- Overrides:
mobile_getContextListin classHelper- Returns:
-
mobile_longPress
public static void mobile_longPress(EnhancedBy target, long miliSeconds)
press per retry presses the target element- Parameters:
target-index-miliSeconds-expected-
-
mobile_longPressAndExpect
public static void mobile_longPressAndExpect(EnhancedBy target, long miliSeconds, EnhancedBy expected)
long press And expect element- Parameters:
target-miliSeconds-expected-
-
mobile_zoomOut
public static void mobile_zoomOut(int zoomLevel)
zoom in based on zoom levels. eg. 3 equals zooming out 3 times- Parameters:
zoomLevel-
-
mobile_zoomOut
public static void mobile_zoomOut(EnhancedBy indicator)
zooms out And checks if target level indicator has been reached- Parameters:
zoomLevel-indicator-
-
mobile_zoomIn
public static void mobile_zoomIn(EnhancedBy indicator)
zooms in And checks if target level indicator has been reached- Parameters:
zoomLevel-indicator-
-
mobile_zoomIn
public static void mobile_zoomIn(int zoomLevel)
zoom in based on zoom levels. eg. 3 equals zooming in 3 times- Parameters:
zoomLevel-
-
scrollDown
public static void scrollDown()
scrolls down android
-
mobile_scrollToElement
public static void mobile_scrollToElement(EnhancedBy target)
scrolls to mobile element until element is becomes visible- Parameters:
target-
-
maximizePage
public static void maximizePage()
maximizes web page
-
setPageSize
public static void setPageSize(int x, int y)sets page size- Parameters:
x-y-
-
refreshPage
public static void refreshPage()
reload page
-
switchIframe
public static void switchIframe(EnhancedBy frame)
switches frame to frame specified- Parameters:
frame-
-
switchToDefaultFrame
public static void switchToDefaultFrame()
switches to default frame
-
dimissAlert
public static String dimissAlert()
dismisses alert by selecting ok or cancel return alert message- Parameters:
alert-
-
acceptAlert
public static String acceptAlert()
accepts alert by selecting ok or cancel- Parameters:
alert-
-
getAlertValue
public static String getAlertValue()
returns alert message value- Returns:
-
currentWindow
public static String currentWindow()
return the current window handle- Returns:
-
switchToNewWindow
public static void switchToNewWindow(String defaultWindow)
switch to the new opened window- Parameters:
defaultWindow-
-
CloseAndReturn
public static void CloseAndReturn(String defaultWindow)
close the window And return to the defaultWindow- Parameters:
defaultWindow-
-
refreshPageSource
public static void refreshPageSource()
gets page source
-
verifyTitle
public static void verifyTitle(String appTitle)
verify page title- Parameters:
appTitle-
-
switchDriver
public static void switchDriver(org.openqa.selenium.WebDriver driver)
switch webdriver use for switching between different drivers- Parameters:
driver-
-
setDriver
public static void setDriver(org.openqa.selenium.WebDriver driver)
-
switchToNextTab
public static void switchToNextTab()
switch to next tab
-
switchToPreviousTab
public static void switchToPreviousTab()
switch to next tab circles back to initial tab if it reaches the last tab
-
switchToTab
public static void switchToTab(int index)
switch to previous tab circle back to the last tab
-
verifyNumberOfTabs
public static void verifyNumberOfTabs(int tabs)
switch to tab by index
-
getPageTitle
public static String getPageTitle()
returns the title of the page- Returns:
-
getCurrentUrl
public static String getCurrentUrl()
returns the current url- Returns:
-
getPageSource
public static String getPageSource()
gets page source- Returns:
-
navigateBack
public static void navigateBack()
navigates back
-
navigateForward
public static void navigateForward()
navigate forward
-
deleteAllCookies
public static void deleteAllCookies()
delete all cookies
-
deleteCookieNamed
public static void deleteCookieNamed(String name)
delete cookie named- Parameters:
name-
-
bringPageToFront
public static void bringPageToFront()
brings current browser to front
-
swtichUrl
public static void swtichUrl(String url)
navigate to a different url- Parameters:
url-
-
getUrl
public static void getUrl(String url)
navigate to a different url- Parameters:
url-
-
navigateToUrl
public static void navigateToUrl(String url)
navigate to a different url- Parameters:
url-
-
getClipboardData
public static String getClipboardData()
retrieves the clip board data- Returns:
-
quitCurrentDriver
public static void quitCurrentDriver()
quits the current web driver
-
quitDriver
public static void quitDriver(org.openqa.selenium.WebDriver driver)
quit driver- Parameters:
driver-
-
quitAllCurrentTestDrivers
public static void quitAllCurrentTestDrivers()
quits all drivers in the current test
-
isVisibleInViewport
public static Boolean isVisibleInViewport(EnhancedBy by, int index)
returns true if the element is visible in the current page only for web applications- Parameters:
by-- Returns:
-
getWebdriver
public static org.openqa.selenium.WebDriver getWebdriver()
get current webdriver- Returns:
-
scrollBottomPageBrowser
public static void scrollBottomPageBrowser()
scroll to bottom of browser
-
scrollUpBrowser
public static void scrollUpBrowser(int count)
scroll up the browser
-
scrollUpBrowser
public static void scrollUpBrowser()
scroll up the browser
-
scrollDownBrowser
public static void scrollDownBrowser(int count)
scroll down the browser
-
scrollDownBrowser
public static void scrollDownBrowser()
scroll down the browser
-
scrollToWebElement
public static void scrollToWebElement(EnhancedBy element)
scroll to web element- Parameters:
element-
-
isMicrosoftEdge
public boolean isMicrosoftEdge()
- Overrides:
isMicrosoftEdgein classHelper
-
scrollToWebElement
public static void scrollToWebElement(EnhancedBy element, int index)
scroll to element- Parameters:
element-index-
-
isVisibleInViewport
public static Boolean isVisibleInViewport(EnhancedBy by)
returns true if the element is visible in the current page only for web applications- Parameters:
by-- Returns:
-
getAttribute
public static String getAttribute(EnhancedBy byValue, String attribute)
gets specified attribute of the element- Parameters:
byValue-index-attribute-
-
isElementContainingClass
public static boolean isElementContainingClass(EnhancedBy by, String classValue)
returns true if element contains class value- Parameters:
by-classValue-- Returns:
-
isAttributeContaining
public static boolean isAttributeContaining(EnhancedBy by, String attribute, String value)
returns true if element contains attribute value- Parameters:
by-classValue-- Returns:
-
getAttribute
public static String getAttribute(EnhancedBy byValue, int index, String attribute)
gets specified attribute of the element based on index- Parameters:
byValue-index-attribute-
-
setAttribute
public static void setAttribute(EnhancedBy by, String attribute, String value)
sets attribute value of an element- Parameters:
by-attribute-value-
-
setAttribute
public static void setAttribute(EnhancedBy by, int index, String attribute, String value)
sets attribute value of an element- Parameters:
by-index-attribute-value-
-
getElementSize
public static org.openqa.selenium.Dimension getElementSize(EnhancedBy by)
returns element dimension- Parameters:
by-- Returns:
-
getElementPosition
public static org.openqa.selenium.Point getElementPosition(EnhancedBy by)
get element position on display- Parameters:
by-- Returns:
-
getElementPosition
public static org.openqa.selenium.Point getElementPosition(EnhancedBy by, int index)
get element position on display- Parameters:
by-index-- Returns:
-
findElementCoordinates
public static int[] findElementCoordinates(EnhancedBy target)
returns the center coordinates of the target element- Parameters:
target-- Returns:
-
findMiddleOfElement
public static int[] findMiddleOfElement(EnhancedBy target)
returns the center coordinates of the target element- Parameters:
target-- Returns:
-
waitForElementToLoad
public static void waitForElementToLoad(EnhancedBy target)
waits for element to be displayed for amount of time specified by 60 seconds- Parameters:
target-
-
waitForElementToLoad
public static boolean waitForElementToLoad(EnhancedBy target, int time)
waits for element to load count() checks if the element is displayed Then gets the count number- Parameters:
target-time-
-
waitForFirstElementToLoad
public static boolean waitForFirstElementToLoad(EnhancedBy element1, EnhancedBy element2, EnhancedBy element3)
waits for either element to load returns true When first item loads- Parameters:
element1-element2-time-- Returns:
-
waitForFirstElementToLoad
public static boolean waitForFirstElementToLoad(EnhancedBy element1, EnhancedBy element2, EnhancedBy element3, int time)
waits for either element to load returns true When first item loads- Parameters:
element1-element2-time-- Returns:
-
waitForFirstElementToLoad
public static boolean waitForFirstElementToLoad(EnhancedBy element1, EnhancedBy element2, int time)
waits for either element to load returns true When first item loads- Parameters:
element1-element2-time-- Returns:
-
waitForFirstElementToLoad
public static boolean waitForFirstElementToLoad(EnhancedBy element1, EnhancedBy element2)
waits for either element to load returns true When first item loads- Parameters:
element1-element2-time-- Returns:
-
mobile_waitAndRefreshForElementToLoad
public static void mobile_waitAndRefreshForElementToLoad(EnhancedBy target, int time)
waits for element to load And refreshes the app each time to renew the dom- Parameters:
target-
-
mobile_waitAndRefreshForElementToLoad
public static void mobile_waitAndRefreshForElementToLoad(EnhancedBy target)
waits for element to load And refreshes the app each time to renew the dom- Parameters:
target-
-
waitForElementToLoad
public static boolean waitForElementToLoad(EnhancedBy target, int time, int count)
waits for element to load If mobile device, scrolls down the page until element is visible- Parameters:
target- : element to wait fortime- : max time to waitcount- : minimum count of elements to wait for in list- Returns:
-
waitForAdditionalElementsToLoad
public static void waitForAdditionalElementsToLoad(EnhancedBy target, int originalCount)
waits for element count to increase from the originalCount Usefull When waiting for a list to expand with additional items- Parameters:
target-originalCount-
-
waitForAdditionalElementsToLoad
public static void waitForAdditionalElementsToLoad(EnhancedBy target, int originalCount, int time)
waits for element count to increase from the originalCount Usefull When waiting for a list to expand with additional items- Parameters:
target-originalCount-
-
waitForElementToBeRemoved
public static boolean waitForElementToBeRemoved(EnhancedBy target)
waits for element to not be displayed wait for maximum of 60 seconds- Parameters:
target-- Returns:
-
waitForElementToBeRemoved
public static boolean waitForElementToBeRemoved(EnhancedBy target, int time)
waits for element to not be displayed- Parameters:
target-time- : maximum amount of time in seconds to wait
-
waitForElementToBeRemoved
public static boolean waitForElementToBeRemoved(EnhancedBy target, int time, int waitForTargetToLoadInSeconds)
waits for element to not be displayed- Parameters:
target-time- : maximum amount of time in seconds to wait. use AbstractDriver.TIMEOUT_SECONDS for default timeoutwaitForTargetToLoadInSeconds- wait for element to load before waiting for element to be removed
-
waitForSeconds
public static void waitForSeconds(double seconds)
waits for number of seconds- Parameters:
seconds-
-
waitForPageToLoad
public static void waitForPageToLoad()
waits for webpage to load
-
waitForListItemToLoad_Contains
public static void waitForListItemToLoad_Contains(EnhancedBy list, String option)
waits for item containing in list to load- Parameters:
list-option-time-
-
waitForTextToLoad
public static void waitForTextToLoad(EnhancedBy target, String text)
waits for text to be loaded for amount of time specified by 60 seconds- Parameters:
target-
-
waitForTextToLoad
public static void waitForTextToLoad(EnhancedBy target, int time, String text)
make sure only one element And caller needs to take responsibility to have text in the element- Parameters:
target-time-
-
waitForElementToBeClickable
public static boolean waitForElementToBeClickable(EnhancedBy selector)
wait for element to become clickable causes instability with hybrid mobile app- Parameters:
selector-- Returns:
-
waitForElementToBeClickable
public static boolean waitForElementToBeClickable(EnhancedBy selector, int timeInSeconds)
wait for element to become clickable causes instability with hybrid mobile app- Parameters:
selector-- Returns:
-
waitForClassContain
public boolean waitForClassContain(EnhancedBy target, int index, String value)
wait for class to contain- Overrides:
waitForClassContainin classHelper- Parameters:
target-index-value-- Returns:
-
waitForClassContain
public boolean waitForClassContain(EnhancedBy target, int index, String value, int time)
wait for class to contain value- Overrides:
waitForClassContainin classHelper- Parameters:
target-index-value-time-- Returns:
-
waitForAnyTextToLoadContaining
public static boolean waitForAnyTextToLoadContaining(EnhancedBy target, String... text)
wait for any text strings to become available- Parameters:
target-time-text-- Returns:
-
waitForAnyTextToLoadContaining
public static boolean waitForAnyTextToLoadContaining(EnhancedBy target, int time, String... text)
wait for any text strings to become available- Parameters:
target-time-text-- Returns:
-
waitForAnyTextToLoad
public static boolean waitForAnyTextToLoad(EnhancedBy target, String... text)
wait for any text strings to become available- Parameters:
target-time-text-- Returns:
-
waitForAnyTextToLoad
public static boolean waitForAnyTextToLoad(EnhancedBy target, int time, String... text)
wait for any text strings to become available- Parameters:
target-time-text-- Returns:
-
start
public static StopWatchHelper start()
StopWatchHelper watch = Helper.start(); do something long passedTimeInMs = watch.time(); long passedTimeInSeconds = watch.time(TimeUnit.SECONDS);- Returns:
-
generateRandomString
public static String generateRandomString(int len)
generates random string of length len- Parameters:
len-- Returns:
-
generateRandomInteger
public static String generateRandomInteger(int len)
generates random int of length len- Parameters:
len-- Returns:
-
generateRandomNumber
public static int generateRandomNumber(int min, int max)generates random number between two numbers, min, max- Parameters:
min-max-- Returns:
-
generateUUID
public static String generateUUID()
generate uuid- Returns:
-
generateUUID
public static String generateUUID(boolean includeDash)
generate uuid- Parameters:
includeDash-- Returns:
-
generateUUID
public static String generateUUID(int length)
generate uuid- Parameters:
length-- Returns:
-
generateUUID
public static String generateUUID(int length, boolean includeDash)
generate uuid- Parameters:
length-- Returns:
-
highLightWebElement
public static void highLightWebElement(EnhancedBy by, int index)
highlights the web element use on clicks and send key elements- Parameters:
by-index-
-
isMac
public static boolean isMac()
returns true if OS is mac- Returns:
-
isWindows
public static boolean isWindows()
returns true if OS is windows- Returns:
-
isUnix
public static boolean isUnix()
returns true if OS is unix or linux- Returns:
-
isUUID
public static boolean isUUID(String value)
is the string value UDID- Parameters:
value-- Returns:
-
isBoolean
public static boolean isBoolean(String value)
returns if string is boolean- Parameters:
value-- Returns:
-
isNumeric
public static boolean isNumeric(String value)
return if string is a number- Parameters:
str-- Returns:
-
executeJs
public static Object executeJs(String script, Object... args)
execute javascript- Parameters:
script-
-
executeJsWithListReturn
public static List<String> executeJsWithListReturn(String script, Object... args)
execute javascript- Parameters:
script-
-
executeJsWithStringReturn
public static String executeJsWithStringReturn(String script, Object... args)
execute javascript- Parameters:
script-
-
getIntFromString
public static int getIntFromString(String value)
get numeric value from string- Parameters:
value-isFailOnNoInt-- Returns:
-
getNumber
public static int getNumber(String value)
get numeric value from string- Parameters:
value-isFailOnNoInt-- Returns:
-
getFirstNumber
public static int getFirstNumber(String value)
-
getIntFromString
public static int getIntFromString(String value, boolean isFailOnNoInt)
get numeric value from string- Parameters:
value-isFailOnNoInt-- Returns:
-
getDoubleFromString
public static double getDoubleFromString(String value)
get int value from string- Parameters:
value-isFailOnNoInt-- Returns:
-
isStringContainOnlyNumber
public static boolean isStringContainOnlyNumber(String value)
does string have only numeric value- Parameters:
value-- Returns:
-
isStringContainNumber
public static boolean isStringContainNumber(String value)
does string have numeric value- Parameters:
value-- Returns:
-
removeSurroundingQuotes
public static String removeSurroundingQuotes(String value)
remove surrounding double quotes from the string- Parameters:
value-- Returns:
-
convertToUrl
public static URL convertToUrl(String url)
converts url string to url object- Parameters:
url-- Returns:
-
isUrlAbleToConnect
public static boolean isUrlAbleToConnect(URL source, Proxy proxy)
check if able to connect to source url- Parameters:
source-proxy- set to null if no proxy- Returns:
-
isProxyRequired
public static boolean isProxyRequired(URL url)
get proxy state from proxy enabled config values: true, false, auto if auto is set, then through proxy detection, we set value to true or false- Parameters:
url-- Returns:
-
getDoubleFromString
public static double getDoubleFromString(String value, boolean isFailOnNoInt)
get numeric value from string- Parameters:
value-isFailOnNoInt-- Returns:
-
isFileContainString
public static boolean isFileContainString(String value, File file)
does file contain the given text value- Parameters:
value-file-- Returns:
-
isServerOnline
public static boolean isServerOnline(String url, String proxyUrl)
checks if server is online- Parameters:
url-proxyUrl-- Returns:
-
isFileContainsString
public static boolean isFileContainsString(String value, File file)
does file contain the given text value- Parameters:
value-file-- Returns:
-
getLinesInFileStartingWith
public static List<String> getLinesInFileStartingWith(String value, File file)
get line in file starting with string- Parameters:
value-file-- Returns:
-
getLinesInFileContainingWith
public static List<String> getLinesInFileContainingWith(String value, File file)
get line in file containing string- Parameters:
value-file-- Returns:
-
printPageSource
public static void printPageSource()
prints page source to console
-
convertListToString
public static String convertListToString(ArrayList<String> list, String separator)
convert array list to string separated by ","- Parameters:
list-- Returns:
-
convertListToString
public static String convertListToString(ArrayList<String> list)
convert array list to string separated by ","- Parameters:
list-- Returns:
-
stringNormalize
public static String stringNormalize(String value)
normalizes string removes space, new line chars- Parameters:
value-- Returns:
-
stringRemoveLines
public static String stringRemoveLines(String value)
normalizes string removes space, new line chars- Parameters:
value-- Returns:
-
killWindowsProcess
public static void killWindowsProcess(String serviceName)
returns kills the process if running- Parameters:
serviceName-- Throws:
Exception
-
killMacProcess
public static void killMacProcess(String serviceName)
returns kills the process if running- Parameters:
serviceName-- Throws:
Exception
-
createFileFromPath
public static File createFileFromPath(String absolutePath)
create directories and files based on absolute path- Parameters:
path-
-
writeFile
public static void writeFile(String value, String path, String filename, String type)
Create file with path starting from root directory (where pom.xml is) and write to it. eg. writeFile("something","", "myFile", "txt");- Parameters:
value- value in filepath- path from rootfilename- name of the filetype- type of file
-
writeFile
public static void writeFile(String value, String absolutePath)
Create file (where pom.xml is) and write to it- Parameters:
value-absolutePath-
-
deleteFile
public static void deleteFile(String absolutePath)
delete file- Parameters:
absolutePath-
-
appendToFile
public static void appendToFile(String value, String absolutePath)
appends to existing file- Parameters:
value-absolutePath-
-
appendToFile
public static void appendToFile(String value, String directory, String filename, String type)
appends to existing file- Parameters:
value-directory-filename-type-
-
executeCommand
public static ArrayList<String> executeCommand(String command)
run command and return results as array list will run bash on linux or mac will run batch command on windows- Parameters:
command-- Returns:
- Throws:
IOException
-
executeCommandFromFile
public static ArrayList<String> executeCommandFromFile(String filePath)
run script file and return results as array list will run bash on linux or mac will run batch command on windows- Parameters:
filePath- path from the root directory ( where pom.xml is )- Returns:
- the results as arraylist
-
copyDirectory
public static void copyDirectory(String dirFrom, String dirTo)
Copies directory And all content from dirFrom to dirTo overwrites the content- Parameters:
dirFrom-dirTo-
-
zipFolder
public static ZipOutputStream zipFolder(String srcFolder, String destZipFile)
zip folder- Parameters:
srcFolder-destZipFile-- Returns:
- Throws:
Exception
-
createZip
public static ZipOutputStream createZip(String destZipFile)
-
addFileToZip
public static void addFileToZip(String path, String srcFile, ZipOutputStream zip)
-
getAllValuesStartringWith
public static List<String> getAllValuesStartringWith(String source, String value)
gets a list of string from 'source' starting with 'value'- Parameters:
source-value-- Returns:
-
getValueFromPattern
public static String getValueFromPattern(String str, String pattern)
- Parameters:
str-pattern- regular expression pattern- Returns:
-
getValuesFromPattern
public static List<String> getValuesFromPattern(String str, String pattern)
- Parameters:
str-pattern- regular expression pattern- Returns:
-
getRootDir
public static String getRootDir()
get current directory- Returns:
-
getFile
public static File getFile(String directoryPath)
get file from file path- Parameters:
directoryPath-- Returns:
-
getFileByName
public static File getFileByName(String path, String filename)
get file by name- Parameters:
path-filename-- Returns:
-
getFileByName
public static File getFileByName(String path, String filename, boolean includeSubDir)
get file by name- Parameters:
path-filename-- Returns:
-
getFileListByType
public static ArrayList<File> getFileListByType(String directoryPath, String type, boolean includeSubtype)
gets the list of files- Returns:
-
getFileListByType
public static ArrayList<File> getFileListByType(String directoryPath, String type)
gets the list of files- Returns:
-
getFileList
public static ArrayList<File> getFileList(String directoryPath)
returns the list of files in directory- Parameters:
directoryPath-- Returns:
-
getFullPath
public static String getFullPath(String path)
gets full path from relative path relative path is from root directory ( where pom.xml file is located )- Parameters:
path-- Returns:
-
getFileList
public static ArrayList<File> getFileList(String directoryPath, boolean includeSubDir)
returns the list of files in directory- Parameters:
directoryPath-- Returns:
-
getFileListWithSubfolders
public static List<File> getFileListWithSubfolders(String directoryName, List<File> files)
gets list of files including from sub folder based on type. eg. ".csv"- Returns:
-
getFileListWithSubfolders
public static List<File> getFileListWithSubfolders(String directoryName, String type, List<File> files)
gets list of files including from sub folder based on type. eg. ".csv"- Returns:
-
readFileContent
public static String readFileContent(String absolutePath)
gets file content as String- Parameters:
absolutePath-- Returns:
-
getFileContent
public static String getFileContent(String absolutePath)
gets file content as String- Parameters:
absolutePath-- Returns:
-
getFileContent
public static String getFileContent(String absolutePath, boolean verifyFileExists)
gets file content as String- Parameters:
absolutePath-- Returns:
-
captureExtentReportScreenshot
public static void captureExtentReportScreenshot()
captures screenshot And attaches to extent test report- Parameters:
description-
-
screenshotCapture
public static void screenshotCapture()
-
hoverBy
public static void hoverBy(EnhancedBy by)
hover over element- Parameters:
by-
-
hoverBy
public static void hoverBy(EnhancedBy by, int index)
hover over element- Parameters:
by-
-
inputTextByAction
public void inputTextByAction(EnhancedBy by, String text)
- Overrides:
inputTextByActionin classHelper
-
doubleClickBy
public static void doubleClickBy(EnhancedBy by)
-
hoverPoints
public static void hoverPoints(int x, int y)Hover on the x,y points- Parameters:
x-y-
-
moveToElement
public static void moveToElement(EnhancedBy target, int index)
move to element by using action- Parameters:
target-index-
-
moveToElement
public static void moveToElement(EnhancedBy target, int index, int xOffset, int yOffset)
move to element by using action- Parameters:
target-index-
-
sendMail
public static void sendMail(EmailObject email)
sends email to recipient using email object- Throws:
Exception
-
handleDifferentUser
public static void handleDifferentUser()
if single signin enabled, And new test user is different form previous, shutdown webdriver And restart- Parameters:
newUserName-- Throws:
Exception
-
localize
public static String localize(String key)
gets local language from json file specified in properties file- Parameters:
key-- Returns:
-
localizationLoadJson
public static void localizationLoadJson(String fileName)
loads localization map from a json file to the test object data- Parameters:
fileName-
-
localizationSetupCsv
public static void localizationSetupCsv(String language)
sets the language for csv localization file- Parameters:
language-
-
runApiContaining
public static void runApiContaining(String identifier, String prefix, String getApi, String targetApiId, String variable, String targerApi) throws org.json.JSONException
runApiContaining("name", "zzz_","getCompanies", "id","companyId","deleteCompany") get all companies with name containing zzz_, Then gets id of these companies, stores them in companyId variable And calls deleteCompany- Parameters:
getApi- : api to search for identifier. eg. name containing "zzz"prefix- : value containing in getApi. eg. name containing "zzz"identifier- : api to call to get all values. eg. getCompaniestargetApiId- : id used to call target api.eg. id for deleteCompany apivariable- : variable the id is stored in csv keyword file. eg companyIdtargerApi- : api to call. eg. deleteCompany- Throws:
org.json.JSONException
-
runApiEquals
public static void runApiEquals(String identifier, String value, String getApi, String targetApiId, String variable, String targerApi) throws org.json.JSONException
runApiEquals("name", "test123","getCompanies", "id","companyId","deleteCompany") get all companies with name equals test123, Then gets id of these companies And calls delete with id- Parameters:
getApi- : api to search for identifier. eg. name equals "test123"value- : value containing in getApi. eg. name equals "test123"identifier- : api to call to get all values. eg. getCompaniestargetApiId- : id used to call target api.eg. id for deleteCompany apivariable- : variable the id is stored in csv keyword file. eg companyIdtargerApi- : api to call. eg. deleteCompany- Throws:
org.json.JSONException
-
-