-1

Good evening, colleagues!

I need help to extract list of arrivals:

I have the following snippet of the code as below one: ...

WebElement newArrivals = driver.findElement(By.xpath(
        ("//*[text()='New Arrivals']")));

List<WebElement> liElements = newArrivals.findElements(By
        .className("like_products_box"));

driver.findElement(By.xpath("//*[text()='New Arrivals']")).click();

The problem is in debug I'm still getting zero (0) as result (products). For this reason, I'm attaching the screen.

Also I have already tried multiple variants with cssSelectors, xpath and so on, but still looking for any valid ideas with it.

/*WebElement ulElement = driver
                .findElement(By.xpath("/html/body/div[1]/div[4]/ul"));
        List<WebElement> liElements = ulElement.findElements(By.tagName("div"));*/

        /*WebElement industries = driver.findElement(
                By.cssSelector("body > div:nth-child(22) > div > div > div > div.like_title.themes_box_title"));*/

        /*WebElement newArrivals = driver.findElement(By.xpath(
                ("//*[text()='New Arrivals']")));*/

I hope someone will not ignore my request and help with it or, at least, recommend me what to read.

Thank you in advance for your time on looking it.

UPD #1:

newArrivals = driver.find_element(By.XPATH, "//div[contains(@class, 'like_title') and contains(@class, 'themes_box_title')]")

It works, but I need to extract the whole list of products not one of them specifically.

enter image description here

UPD #2:

List<WebElement> liElements = driver.findElements(By
                .xpath( "//div[contains(@class, 'like_title') and contains(@class, 'themes_box_title')]"));

It works, as well, but it extracts also just one good instead list of them.

enter image description here

UPD #3:

I need to extract by like_products_box instead of themes_box_title.

...

<div class="products_may_like">
    <div class="wide">
      <div class="like_title themes_box_title">New Arrivals</div>
      <div class="like_products_box">

...

UPD #4:

The following snippets return me, as well, zero(0):

1.

List<WebElement> liElements = driver.findElements(By.
                xpath("div[@class='like_products_box']//div[contains(@class,'like_products_item')]"));
List<WebElement> liElements = driver.findElements(By.
                xpath( "//div[@class='like_title']//div[@class='like_products_box']"));
List<WebElement> liElements = driver.findElements(By.
                xpath("a[@class='item_name themes_products_title']"));

enter image description here

1 Answer 1

0

Final working solution should be as below:

List<WebElement> liElements = driver.findElements(By.
                className("like_products_item"));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.