@@ -78,8 +78,8 @@ public Boolean isOnPage(String requiredURL) {
7878 *
7979 * @param webElementKey
8080 * -The XPath which must Present on Web Page
81- * @return WebElement element -Will Return WebElement which is present on Web
82- * Page with Mentioned XPath
81+ * @return WebElement element -Will Return WebElement which is present on
82+ * Web Page with Mentioned XPath
8383 */
8484public WebElement getElementByXPath (String webElementKey ) {
8585stopWatch = new StopWatch ();
@@ -96,12 +96,13 @@ public WebElement getElementByXPath(String webElementKey) {
9696}
9797
9898/**
99- * To get WebElement by specifying CSS Selector of Element Present on Web Page
99+ * To get WebElement by specifying CSS Selector of Element Present on Web
100+ * Page
100101 *
101102 * @param webElementKey
102103 * -The CSS Selector which must Present on Web Page
103- * @return WebElement element -Will Return WebElement which is present on Web
104- * Page with Mentioned CssSelector
104+ * @return WebElement element -Will Return WebElement which is present on
105+ * Web Page with Mentioned CssSelector
105106 */
106107public WebElement getElementByCSS (String webElementKey ) {
107108stopWatch = new StopWatch ();
@@ -118,15 +119,15 @@ public WebElement getElementByCSS(String webElementKey) {
118119}
119120
120121/**
121- * To get WebElement by specifying prefix of selector and key of cssSelctor of
122- * Element Present on Web Page
122+ * To get WebElement by specifying prefix of selector and key of cssSelctor
123+ * of Element Present on Web Page
123124 *
124125 * @param webElementKey
125126 * -The key of CSS Selector which must be Present on Web Page
126127 * @param prefix
127128 * -The prefix of cssSelector
128- * @return WebElement element -Will Return WebElement which is present on Web
129- * Page with Mentioned CssSelector
129+ * @return WebElement element -Will Return WebElement which is present on
130+ * Web Page with Mentioned CssSelector
130131 */
131132public WebElement getElementByCSS (String prefix , String webElementKey ) {
132133stopWatch = new StopWatch ();
@@ -144,8 +145,7 @@ public WebElement getElementByCSS(String prefix, int index, String suffix) {
144145stopWatch = new StopWatch ();
145146stopWatch .start ();
146147WebDriverWait webDriverWait = new WebDriverWait (webDriver , 30 );
147- webDriverWait .until (ExpectedConditions
148- .visibilityOfElementLocated (By .cssSelector (getSelectors (prefix ) + index + getSelectors (suffix ))));
148+ webDriverWait .until (ExpectedConditions .visibilityOfElementLocated (By .cssSelector (getSelectors (prefix ) + index + getSelectors (suffix ))));
149149WebElement element = webDriver .findElement (By .cssSelector (getSelectors (prefix ) + index + getSelectors (suffix )));
150150LOGGER .info ("Located Web Element" );
151151jScriptExecutor = (JavascriptExecutor ) webDriver ;
@@ -156,8 +156,8 @@ public WebElement getElementByCSS(String prefix, int index, String suffix) {
156156}
157157
158158/**
159- * Method to get Array of WebElement by specifying XPath of Elements Present on
160- * Web Page
159+ * Method to get Array of WebElement by specifying XPath of Elements Present
160+ * on Web Page
161161 *
162162 * @param webElementKey
163163 * -XPath of Elements Present on Web Page
@@ -200,8 +200,7 @@ public List<WebElement> getArrayOfElementByCSS(String webElementKey) {
200200WebDriverWait webDriverWait = new WebDriverWait (webDriver , 30 );
201201webDriverWait .ignoring (NoSuchElementException .class );
202202webDriverWait .ignoring (TimeoutException .class );
203- webDriverWait
204- .until (ExpectedConditions .visibilityOfElementLocated (By .cssSelector (getSelectors (webElementKey ))));
203+ webDriverWait .until (ExpectedConditions .visibilityOfElementLocated (By .cssSelector (getSelectors (webElementKey ))));
205204dropDownList = webDriver .findElements (By .cssSelector (getSelectors (webElementKey )));
206205stopWatch .stop ();
207206LOGGER .info ("Time taken to load element is {} Milliseconds" , stopWatch .getTime ());
@@ -232,8 +231,7 @@ public List<WebElement> getArrayOfElementByCSS(String suffix, String webElementK
232231WebDriverWait webDriverWait = new WebDriverWait (webDriver , 30 );
233232webDriverWait .ignoring (NoSuchElementException .class );
234233webDriverWait .ignoring (TimeoutException .class );
235- webDriverWait .until (ExpectedConditions
236- .visibilityOfElementLocated (By .cssSelector (suffix + getSelectors (webElementKey ))));
234+ webDriverWait .until (ExpectedConditions .visibilityOfElementLocated (By .cssSelector (suffix + getSelectors (webElementKey ))));
237235dropDownList = webDriver .findElements (By .cssSelector (suffix + getSelectors (webElementKey )));
238236stopWatch .stop ();
239237LOGGER .info (suffix + getSelectors (webElementKey ));
@@ -262,8 +260,8 @@ public String getCurrentURL() {
262260 *
263261 * @param webElementKey
264262 * -The LinkText of element which is Present on Web Page
265- * @return WebElement element -Will Return WebElement which is present on Web
266- * Page with Mentioned LinkText
263+ * @return WebElement element -Will Return WebElement which is present on
264+ * Web Page with Mentioned LinkText
267265 */
268266public WebElement getElementByLink (String webElementKey ) {
269267stopWatch = new StopWatch ();
@@ -417,6 +415,15 @@ public void selectValueInDropDownByVisibleText(WebElement webElement, String val
417415webElementSelect .selectByVisibleText (value );
418416}
419417
418+ /**
419+ * Used to draw a signature on canvas
420+ *
421+ * @param webElementKey
422+ * Selector key for canvas element
423+ * @param signatureID
424+ * Signature ID mentioned in YML file to get the coordinates to
425+ * draw signature
426+ */
420427public void drawOnCanvas (String webElementKey , String signatureID ) {
421428List <Point > points = PropertiesUtility .getSignatureCoordinates (signatureID );
422429WebElement canvas = getElementByCSS (webElementKey );
@@ -428,6 +435,12 @@ public void drawOnCanvas(String webElementKey, String signatureID) {
428435drawAction .release ().perform ();
429436}
430437
438+ /**
439+ * Used to get Doller value by excluding $ sign
440+ *
441+ * @param webElementKey
442+ * @return floating value
443+ */
431444public float getDollerAmountByCSS (String webElementKey ) {
432445float amount ;
433446webElementKey = getElementByCSS (webElementKey ).getText ();
@@ -437,6 +450,13 @@ public float getDollerAmountByCSS(String webElementKey) {
437450return amount ;
438451}
439452
453+ /**
454+ * Used to compare two float values
455+ *
456+ * @param n1
457+ * @param n2
458+ * @return
459+ */
440460public boolean isEqual (float n1 , float n2 ) {
441461return Math .abs (n1 - n2 ) < 0.0001 ;
442462}
0 commit comments