33import anhtester .com .reports .ExtentTestManager ;
44import anhtester .com .utils .LogUtils ;
55import com .aventstack .extentreports .Status ;
6+ import io .qameta .allure .Step ;
67import org .openqa .selenium .*;
78import org .openqa .selenium .interactions .Actions ;
89import org .openqa .selenium .support .ui .ExpectedCondition ;
@@ -46,6 +47,7 @@ public static WebElement highLightElement(By by) {
4647 return getWebElement (by );
4748 }
4849
50+ @ Step ("Right click on element {0}" )
4951 public static void rightClickElement (By by ) {
5052 waitForElementVisible (by );
5153 Actions action = new Actions (getDriver ());
@@ -54,20 +56,23 @@ public static void rightClickElement(By by) {
5456 ExtentTestManager .logMessage (Status .PASS , "Right click on element " + by );
5557 }
5658
59+ @ Step ("Open URL: {0}" )
5760 public static void openURL (String URL ) {
5861 getDriver ().get (URL );
5962 waitForPageLoaded ();
6063 LogUtils .info ("Open URL: " + URL );
6164 ExtentTestManager .logMessage (Status .PASS , "Open URL: " + URL );
6265 }
6366
67+ @ Step ("Get current URL" )
6468 public static String getCurrentUrl () {
6569 waitForPageLoaded ();
6670 LogUtils .info ("Get Current URL: " + getDriver ().getCurrentUrl ());
6771 ExtentTestManager .logMessage (Status .PASS , "Get Current URL: " + getDriver ().getCurrentUrl ());
6872 return getDriver ().getCurrentUrl ();
6973 }
7074
75+ @ Step ("Click on element {0}" )
7176 public static void clickElement (By by ) {
7277 waitForElementVisible (by );
7378 highLightElement (by );
@@ -76,13 +81,15 @@ public static void clickElement(By by) {
7681 ExtentTestManager .logMessage (Status .PASS , "Click on element " + by );
7782 }
7883
84+ @ Step ("Set text {1} on element {0}" )
7985 public static void setText (By by , String value ) {
8086 waitForElementVisible (by );
8187 getWebElement (by ).sendKeys (value );
8288 LogUtils .info ("Set text " + value + " on element " + by );
8389 ExtentTestManager .logMessage (Status .PASS , "Set text " + value + " on element " + by );
8490 }
8591
92+ @ Step ("Get text of element {0}" )
8693 public static String getTextElement (By by ) {
8794 waitForElementVisible (by );
8895 LogUtils .info ("Get text of element " + by );
@@ -92,6 +99,7 @@ public static String getTextElement(By by) {
9299 return getWebElement (by ).getText ();
93100 }
94101
102+ @ Step ("Get attribure {1} value of element {0}" )
95103 public static String getAttributeElement (By by , String attributeName ) {
96104 waitForElementVisible (by );
97105 LogUtils .info ("Get attribute value of element " + by );
@@ -116,11 +124,6 @@ public static void scrollToElement(By by) {
116124
117125 }
118126
119- public static void scrollToElementWithRobot (By by ) {
120- //Dùng Robot class
121-
122- }
123-
124127 public static void sleep (double second ) {
125128 try {
126129 Thread .sleep ((long ) (1000 * second ));
0 commit comments