Locating an element within another element
public LocatedCarParksMap locateAndClickOnTheCardByAddressIndicator(String location) {
List<WebElement> quoteCards = driver.findElements(By.cssSelector(".quote-card"));
for (WebElement webElement : quoteCards) {
WebElement locationElement = webElement.findElement(By.cssSelector(".quote-card-asset-location"));
if (locationElement.getText().equals(location)) {
webElement.findElement(By.xpath(".rate-card-description")).click();
}
throw new NoSuchElementException();
}
return this;
}
- Locating list of cards
- iterating through it and locating needed card by locating the element that contains the address i am looking for
- if address is the one i am looking for i am trying to find .rate-card-description within the same card element and then clicking on it to proceed further
I have debugged it and it does locates the address from the card however it cant locate an element within the yellow text are for me to click on
What i am doing wrong, thank you
Comments
Post a Comment