Skip to main content
10 events
when toggle format what by license comment
Sep 27, 2021 at 11:50 comment added jay m @Kate Paulk - have added the updated Code with stack trace
Sep 27, 2021 at 11:22 comment added Kate Paulk @jaym - please update your question with your updated code and the results you are getting. It's difficult to evaluate code in comments.
Sep 24, 2021 at 13:28 comment added jay m Added the element again that needs to be clicked but the stale element exception comes on adding any leads on this - @PDHide
Sep 24, 2021 at 13:12 comment added jay m if i remove that line it leads to stale element - any inputs - @PDHide and if i rediscover the element once again how do i modify the code
Sep 24, 2021 at 13:11 comment added jay m updated my code with changes - it does lead to stale element exception and have added the wait.until(ExpectedConditions.stalenessOf(loadmoreElems)); but now getting : org.openqa.selenium.TimeoutException: Expected condition failed: waiting for element ([[ChromeDriver: chrome on WINDOWS (fb2814833df250e07c6cf007f92d758e)] -> xpath: //span[contains(@class,'mat-button-wrapper') and contains(normalize-space(),'Load More')]]) to become stale (tried for 10 second(s) with 500 milliseconds interval) -@PDHide
Sep 24, 2021 at 13:06 comment added PDHide @jaym There is no loop in your logic , so the execution happens only once . You should use some form of loop . But make sure you rediscover the element as the DOM changes after click and this results in stale element error.
Sep 24, 2021 at 12:33 comment added jay m but leads to stale elemnt exception in the line if(!loadmoreElem.isDisplayed())
Sep 24, 2021 at 12:33 comment added jay m have made changes like this - do { PageUtil.scrolltoBottom(driver); WebDriverWait wait = new WebDriverWait(driver,120); wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//span[contains(@class,'mat-button-wrapper') and contains(normalize-space(),'Load More')]"))); loadmoreElems.click(); DriverUtil.waitTime(5000); if(!loadmoreElem.isDisplayed()) { break; } } while(loadmoreElem.isDisplayed());
Sep 24, 2021 at 12:32 comment added jay m i get what you are saying but just wanted to know if there are more than 10 load more button i need to keep giving this line // once the wait is done, search for the button again - this ensures you won't have a stale element exception to worry about loadmore = driver.getElement(by.xpath(loadmoreXPath)); -@Kate Paulk
Sep 24, 2021 at 12:21 history answered Kate Paulk CC BY-SA 4.0