Can you help me locate and click on the 5th element in this list?
The following is a list of all the rooms stored:
@FindBy(xpath="//p[@class='css-6v9gpl-Text eczcs4p0']")
List<WebElement> placeListings;
Code to click on the 5th element:
public void clickon5thHouse()
{
Web4 = placeListings.get(4); // **This is a list of all the web elements in <div> tag. I am selecting the 4th element from the list to click on it**
int x = Web4.getLocation().getX();
int y = Web4.getLocation().getY();
//scroll to x y
JavascriptExecutor js = (JavascriptExecutor) driver;
WebDriverWait wait;
wait = new WebDriverWait(driver,40);
js.executeScript("window.scrollBy(" +x +", " +y +")");
wait.until(ExpectedConditions.elementToBeClickable(Web4));
Web4.click();
}
Website URL:
- Using Chrome Browser.
- I have tried various scroll methods as mentioned in the commented code section.
- However, the scrollbar seems to reach the same point on the website for all scroll commands.
Error Logs:
org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <p size="6" class="css-6v9gpl-Text eczcs4p0">...</p> is not clickable at point (845, 13).
Other element would receive the click: <a data-testid="listing-details-link" href="/for-sale/details/58485081/" class="e2uk8e4 css-15tydk8-StyledLink-Link-FullCardLink e33dvwd0">...</a>