diff --git a/image_based_actions/pom.xml b/image_based_actions/pom.xml
index 177744d..ec7648d 100644
--- a/image_based_actions/pom.xml
+++ b/image_based_actions/pom.xml
@@ -6,7 +6,7 @@
4.0.0
com.testsigma.addons
image_based_actions
- 1.0.3
+ 1.0.4
jar
diff --git a/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnImage.java b/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnImage.java
index 9c90534..e37e43d 100644
--- a/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnImage.java
+++ b/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnImage.java
@@ -76,7 +76,7 @@ protected Result execute() throws NoSuchElementException {
logger.info("Error ratios: x relative: "+xRelative+" y relative: "+yRelative);
int clickLocationX;
int clickLocationY;
- if (Math.abs(imageWidth-screenWidth) > 5) {
+ if (Math.abs(imageWidth-screenWidth) > 20) {
clickLocationX = (int) (xRelative * screenWidth);
clickLocationY = (int) (yRelative * screenHeight);
} else {
diff --git a/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnImageOccurrenceBased.java b/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnImageOccurrenceBased.java
index 2d3253e..852b80f 100644
--- a/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnImageOccurrenceBased.java
+++ b/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnImageOccurrenceBased.java
@@ -79,7 +79,7 @@ protected Result execute() throws NoSuchElementException {
logger.info("Error ratios: x relative: "+xRelative+" y relative: "+yRelative);
int clickLocationX;
int clickLocationY;
- if(Math.abs(imageWidth-screenWidth) > 5){
+ if(Math.abs(imageWidth-screenWidth) > 20){
clickLocationX = (int) (xRelative * screenWidth);
clickLocationY = (int) (yRelative * screenHeight);
} else {
diff --git a/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnImageWithThreshold.java b/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnImageWithThreshold.java
index 22ddb59..df759eb 100644
--- a/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnImageWithThreshold.java
+++ b/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnImageWithThreshold.java
@@ -79,7 +79,7 @@ protected Result execute() throws NoSuchElementException {
logger.info("Error ratios: x relative: "+xRelative+" y relative: "+yRelative);
int clickLocationX;
int clickLocationY;
- if(Math.abs(imageWidth-screenWidth) > 5){
+ if(Math.abs(imageWidth-screenWidth) > 20){
clickLocationX = (int) (xRelative * screenWidth);
clickLocationY = (int) (yRelative * screenHeight);
} else {
diff --git a/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnImageWithThresholdOccurrenceBased.java b/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnImageWithThresholdOccurrenceBased.java
index 213a91b..4a2dd23 100644
--- a/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnImageWithThresholdOccurrenceBased.java
+++ b/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnImageWithThresholdOccurrenceBased.java
@@ -84,7 +84,7 @@ protected Result execute() throws NoSuchElementException {
logger.info("Error ratios: x relative: "+xRelative+" y relative: "+yRelative);
int clickLocationX;
int clickLocationY;
- if(Math.abs(imageWidth-screenWidth) > 5){
+ if(Math.abs(imageWidth-screenWidth) > 20){
clickLocationX = (int) (xRelative * screenWidth);
clickLocationY = (int) (yRelative * screenHeight);
} else {
diff --git a/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnText.java b/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnText.java
index f9034d5..4ccebb4 100644
--- a/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnText.java
+++ b/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnText.java
@@ -75,7 +75,7 @@ protected Result execute() {
logger.info("Error ratios: x relative: "+xRelative+" y relative: "+yRelative);
int clickLocationX;
int clickLocationY;
- if(Math.abs(imageWidth-screenWidth) > 5){
+ if(Math.abs(imageWidth-screenWidth) > 20){
clickLocationX = (int) (xRelative * screenWidth);
clickLocationY = (int) (yRelative * screenHeight);
} else {
diff --git a/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnTextOccurrenceBased.java b/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnTextOccurrenceBased.java
index beaeaf5..6b97700 100644
--- a/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnTextOccurrenceBased.java
+++ b/image_based_actions/src/main/java/com/testsigma/addons/android/ClickOnTextOccurrenceBased.java
@@ -79,7 +79,7 @@ protected Result execute() {
logger.info("Error ratios: x relative: "+xRelative+" y relative: "+yRelative);
int clickLocationX;
int clickLocationY;
- if(Math.abs(imageWidth-screenWidth) > 5){
+ if(Math.abs(imageWidth-screenWidth) > 20){
clickLocationX = (int) (xRelative * screenWidth);
clickLocationY = (int) (yRelative * screenHeight);
} else {
diff --git a/image_based_actions/src/main/java/com/testsigma/addons/web/DoubleClickOnText.java b/image_based_actions/src/main/java/com/testsigma/addons/web/DoubleClickOnText.java
new file mode 100644
index 0000000..10f9402
--- /dev/null
+++ b/image_based_actions/src/main/java/com/testsigma/addons/web/DoubleClickOnText.java
@@ -0,0 +1,85 @@
+package com.testsigma.addons.web;
+
+import com.testsigma.sdk.ApplicationType;
+import com.testsigma.sdk.OCRTextPoint;
+import com.testsigma.sdk.Result;
+import com.testsigma.sdk.WebAction;
+import com.testsigma.sdk.annotation.Action;
+import com.testsigma.sdk.annotation.OCR;
+import com.testsigma.sdk.annotation.TestData;
+import lombok.Data;
+import org.openqa.selenium.interactions.Actions;
+
+import java.util.List;
+
+@Data
+@Action(actionText = "Double click on text name",
+ description = "Double click on the text using the text coordinates",
+ applicationType = ApplicationType.WEB)
+
+public class DoubleClickOnText extends WebAction {
+ @OCR
+ private com.testsigma.sdk.OCR ocr;
+
+ @TestData(reference = "name")
+ private com.testsigma.sdk.TestData text;
+
+ @Override
+ protected Result execute() {
+ Result result = Result.SUCCESS;
+ List textPoints = ocr.extractTextFromPage();
+ printAllCoordinates(textPoints);
+ OCRTextPoint textPoint = getTextPointFromText(textPoints);
+ if(textPoint == null) {
+ result = Result.FAILED;
+ setErrorMessage("Given text is not found");
+
+ } else {
+ logger.info("Found Textpoint with text = " + textPoint.getText() + ", x1 = " + textPoint.getX1() +
+ ", y1 = " + textPoint.getY1() + ", x2 = " + textPoint.getX2() + ", y2 = " + textPoint.getY2());
+ clickOnCoordinates(textPoint);
+ setSuccessMessage("Click operation performed on the text " +
+ " Text coordinates :" + "x1-" + textPoint.getX1() + ", x2-" + textPoint.getX2() + ", y1-" + textPoint.getY1() + ", y2-" + textPoint.getY2());
+ }
+
+ return result;
+ }
+ private OCRTextPoint getTextPointFromText(List textPoints) {
+ if(textPoints == null) {
+ return null;
+ }
+ for(OCRTextPoint textPoint: textPoints) {
+ if(text.getValue().equals(textPoint.getText())) {
+ return textPoint;
+
+ }
+ }
+ return null;
+ }
+
+ private void printAllCoordinates(List textPoints) {
+ for(OCRTextPoint textPoint: textPoints) {
+ logger.info("text =" + textPoint.getText() + "x1 = " + textPoint.getX1() + ", y1 =" + textPoint.getY1() + ", x2 = " + textPoint.getX2() + ", y2 =" + textPoint.getY2() +"\n\n\n\n");
+ }
+ }
+ public void clickOnCoordinates(OCRTextPoint textPoint) {
+
+ int x1 = textPoint.getX1();
+ int y1 = textPoint.getY1();
+ int x2 = textPoint.getX2();
+ int y2 = textPoint.getY2();
+
+// int x = (x1 + x2) / 2;
+// int y = (y1 + y2) / 2;
+ int x = x2;
+ int y = y2;
+
+ logger.info("MEAN X coordinate: " + x + "\n");
+ logger.info("MEAN Y coordinate: " + y + "\n");
+
+ Actions actions = new Actions(driver);
+ actions.moveToLocation(x, y).doubleClick().build().perform();
+ }
+
+
+}
diff --git a/image_based_actions/src/main/java/com/testsigma/addons/web/DoubleRightClickOnText.java b/image_based_actions/src/main/java/com/testsigma/addons/web/DoubleRightClickOnText.java
new file mode 100644
index 0000000..66dbe7c
--- /dev/null
+++ b/image_based_actions/src/main/java/com/testsigma/addons/web/DoubleRightClickOnText.java
@@ -0,0 +1,85 @@
+package com.testsigma.addons.web;
+
+import com.testsigma.sdk.ApplicationType;
+import com.testsigma.sdk.OCRTextPoint;
+import com.testsigma.sdk.Result;
+import com.testsigma.sdk.WebAction;
+import com.testsigma.sdk.annotation.Action;
+import com.testsigma.sdk.annotation.OCR;
+import com.testsigma.sdk.annotation.TestData;
+import lombok.Data;
+import org.openqa.selenium.interactions.Actions;
+
+import java.util.List;
+
+@Data
+@Action(actionText = "Double right click on text name",
+ description = "Double right click on the text using the text coordinates",
+ applicationType = ApplicationType.WEB)
+
+public class DoubleRightClickOnText extends WebAction {
+ @OCR
+ private com.testsigma.sdk.OCR ocr;
+
+ @TestData(reference = "name")
+ private com.testsigma.sdk.TestData text;
+
+ @Override
+ protected Result execute() {
+ Result result = Result.SUCCESS;
+ List textPoints = ocr.extractTextFromPage();
+ printAllCoordinates(textPoints);
+ OCRTextPoint textPoint = getTextPointFromText(textPoints);
+ if(textPoint == null) {
+ result = Result.FAILED;
+ setErrorMessage("Given text is not found");
+
+ } else {
+ logger.info("Found Textpoint with text = " + textPoint.getText() + ", x1 = " + textPoint.getX1() +
+ ", y1 = " + textPoint.getY1() + ", x2 = " + textPoint.getX2() + ", y2 = " + textPoint.getY2());
+ clickOnCoordinates(textPoint);
+ setSuccessMessage("Click operation performed on the text " +
+ " Text coordinates :" + "x1-" + textPoint.getX1() + ", x2-" + textPoint.getX2() + ", y1-" + textPoint.getY1() + ", y2-" + textPoint.getY2());
+ }
+
+ return result;
+ }
+ private OCRTextPoint getTextPointFromText(List textPoints) {
+ if(textPoints == null) {
+ return null;
+ }
+ for(OCRTextPoint textPoint: textPoints) {
+ if(text.getValue().equals(textPoint.getText())) {
+ return textPoint;
+
+ }
+ }
+ return null;
+ }
+
+ private void printAllCoordinates(List textPoints) {
+ for(OCRTextPoint textPoint: textPoints) {
+ logger.info("text =" + textPoint.getText() + "x1 = " + textPoint.getX1() + ", y1 =" + textPoint.getY1() + ", x2 = " + textPoint.getX2() + ", y2 =" + textPoint.getY2() +"\n\n\n\n");
+ }
+ }
+ public void clickOnCoordinates(OCRTextPoint textPoint) {
+
+ int x1 = textPoint.getX1();
+ int y1 = textPoint.getY1();
+ int x2 = textPoint.getX2();
+ int y2 = textPoint.getY2();
+
+// int x = (x1 + x2) / 2;
+// int y = (y1 + y2) / 2;
+ int x = x2;
+ int y = y2;
+
+ logger.info("MEAN X coordinate: " + x + "\n");
+ logger.info("MEAN Y coordinate: " + y + "\n");
+
+ Actions actions = new Actions(driver);
+ actions.moveToLocation(x, y).contextClick().pause(100).contextClick().build().perform();
+ }
+
+
+}
diff --git a/image_based_actions/src/main/java/com/testsigma/addons/web/RightClickOnText.java b/image_based_actions/src/main/java/com/testsigma/addons/web/RightClickOnText.java
new file mode 100644
index 0000000..c83f72e
--- /dev/null
+++ b/image_based_actions/src/main/java/com/testsigma/addons/web/RightClickOnText.java
@@ -0,0 +1,85 @@
+package com.testsigma.addons.web;
+
+import com.testsigma.sdk.ApplicationType;
+import com.testsigma.sdk.OCRTextPoint;
+import com.testsigma.sdk.Result;
+import com.testsigma.sdk.WebAction;
+import com.testsigma.sdk.annotation.Action;
+import com.testsigma.sdk.annotation.OCR;
+import com.testsigma.sdk.annotation.TestData;
+import lombok.Data;
+import org.openqa.selenium.interactions.Actions;
+
+import java.util.List;
+
+@Data
+@Action(actionText = "Right click on text name",
+ description = "Right click on the text using the text coordinates",
+ applicationType = ApplicationType.WEB)
+
+public class RightClickOnText extends WebAction {
+ @OCR
+ private com.testsigma.sdk.OCR ocr;
+
+ @TestData(reference = "name")
+ private com.testsigma.sdk.TestData text;
+
+ @Override
+ protected Result execute() {
+ Result result = Result.SUCCESS;
+ List textPoints = ocr.extractTextFromPage();
+ printAllCoordinates(textPoints);
+ OCRTextPoint textPoint = getTextPointFromText(textPoints);
+ if(textPoint == null) {
+ result = Result.FAILED;
+ setErrorMessage("Given text is not found");
+
+ } else {
+ logger.info("Found Textpoint with text = " + textPoint.getText() + ", x1 = " + textPoint.getX1() +
+ ", y1 = " + textPoint.getY1() + ", x2 = " + textPoint.getX2() + ", y2 = " + textPoint.getY2());
+ clickOnCoordinates(textPoint);
+ setSuccessMessage("Click operation performed on the text " +
+ " Text coordinates :" + "x1-" + textPoint.getX1() + ", x2-" + textPoint.getX2() + ", y1-" + textPoint.getY1() + ", y2-" + textPoint.getY2());
+ }
+
+ return result;
+ }
+ private OCRTextPoint getTextPointFromText(List textPoints) {
+ if(textPoints == null) {
+ return null;
+ }
+ for(OCRTextPoint textPoint: textPoints) {
+ if(text.getValue().equals(textPoint.getText())) {
+ return textPoint;
+
+ }
+ }
+ return null;
+ }
+
+ private void printAllCoordinates(List textPoints) {
+ for(OCRTextPoint textPoint: textPoints) {
+ logger.info("text =" + textPoint.getText() + "x1 = " + textPoint.getX1() + ", y1 =" + textPoint.getY1() + ", x2 = " + textPoint.getX2() + ", y2 =" + textPoint.getY2() +"\n\n\n\n");
+ }
+ }
+ public void clickOnCoordinates(OCRTextPoint textPoint) {
+
+ int x1 = textPoint.getX1();
+ int y1 = textPoint.getY1();
+ int x2 = textPoint.getX2();
+ int y2 = textPoint.getY2();
+
+// int x = (x1 + x2) / 2;
+// int y = (y1 + y2) / 2;
+ int x = x2;
+ int y = y2;
+
+ logger.info("MEAN X coordinate: " + x + "\n");
+ logger.info("MEAN Y coordinate: " + y + "\n");
+
+ Actions actions = new Actions(driver);
+ actions.moveToLocation(x, y).contextClick().build().perform();
+ }
+
+
+}