File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import org .openqa .selenium .By ;
4
4
import org .openqa .selenium .Keys ;
5
+ import org .openqa .selenium .StaleElementReferenceException ;
5
6
import org .openqa .selenium .WebElement ;
6
7
import org .openqa .selenium .interactions .Actions ;
7
8
import org .openqa .selenium .remote .RemoteWebDriver ;
@@ -76,8 +77,12 @@ public void mouseHoverOnElement(By locator) {
76
77
}
77
78
78
79
public void staleElementRefresh (By locator ) {
79
- WebDriverWait wait = new WebDriverWait (driver , 30 );
80
- wait .until (ExpectedConditions .stalenessOf (driver .findElement (locator )));
80
+ try {
81
+ WebDriverWait wait = new WebDriverWait (driver , 30 );
82
+ wait .until (ExpectedConditions .stalenessOf (driver .findElement (locator )));
83
+ } catch (StaleElementReferenceException exception ) {
84
+ exception .printStackTrace ();
85
+ }
81
86
}
82
87
83
88
public void waitForTime (int timeout ) {
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ public class AddProduct {
66
66
driverHelper .waitForVisibility (WEBSITE_DISCLAIMER_HEADING_ON_HOME_PAGE , 30 );
67
67
boolean value = driver .findElement (WEBSITE_DISCLAIMER_HEADING_ON_HOME_PAGE ).isDisplayed ();
68
68
Assert .assertTrue (value , "Element is not displayed." );
69
- Status = "Passed " ;
69
+ Status = "passed " ;
70
70
}
71
71
72
72
@ AfterMethod public void tearDown () {
Original file line number Diff line number Diff line change @@ -54,15 +54,16 @@ public class CompareProducts {
54
54
driverHelper .getURL ("https://ecommerce-playground.lambdatest.io/" );
55
55
driverHelper .click (SHOP_BY_CATEGORY_NAVIGATION );
56
56
driverHelper .click (PHONE_TABLETS_IPOD_NAVIGATION );
57
- driverHelper .click (HTC_TOUCH_ID_FIRST_PRODUCT );
58
57
driverHelper .mouseHoverOnElement (HTC_TOUCH_ID_FIRST_PRODUCT );
59
58
driverHelper .click (COMPARE_TO_THIS_PRODUCT_OPTION );
60
59
driverHelper .click (APPLE_MANUFACTURER_FILTER );
60
+ driverHelper .waitForVisibility (FIRST_IPOD_PRODUCT , 30 );
61
+ driverHelper .staleElementRefresh (FIRST_IPOD_PRODUCT );
61
62
driverHelper .mouseHoverOnElement (FIRST_IPOD_PRODUCT );
62
63
driverHelper .click (COMPARE_TO_THIS_PRODUCT_OPTION );
63
64
driverHelper .click (COMPARE_PRODUCT_BUTTON );
64
65
driverHelper .isDisplayed (PRODUCT_COMPARISON_HEADING );
65
- Status = "Passed " ;
66
+ Status = "passed " ;
66
67
}
67
68
68
69
@ AfterMethod public void tearDown () {
You can’t perform that action at this time.
0 commit comments