0

I am trying to select multiple filers available in https://www.jabong.com/find/men's-black-jeans using Automation(Firefox).

However, after selecting the first option (Gender), I am unable to proceed.

I faced the Element click intercepted and tried Fluent Wait which lead to Stale Element Exception.

If I remove the Fluent wait or use implicit wait, I sometimes get the Element found exception.

To add to the confusion, sometimes the code runs properly without any wait and am able to select multiple options, but that is rare

 public void case9() {
     driver.get("https://www.jabong.com/");
      WebElement SearchBox = driver.findElement(By.xpath("//*[@id=\"search\"]"));
      SearchBox.sendKeys("men's black jeans");
      Actions actn = new Actions (driver);
      actn.sendKeys(SearchBox, Keys.ENTER).build().perform();
      driver.manage().timeouts().implicitlyWait(34, TimeUnit.SECONDS);
      driver.findElement(By.xpath("//*[@id=\"allFilterPopupTop\"]")).click();
      driver.manage().timeouts().implicitlyWait(34, TimeUnit.SECONDS);
 driver.findElement(By.xpath("/html/body/section[1]/div/section/section[1]/div/div[2]/div[2]/ul/li[1]/div[3]/div/div[2]/label[1]/div/input")).click();


      driver.findElement(By.xpath("//*[@id=\"Brand\"]")).click();
      WebDriverWait wait1 = new WebDriverWait(driver,61);
      WebElement brand1 = 
      driver.findElement(By.xpath("xpath for element"));
      wait1.until(ExpectedConditions.elementToBeClickable(brand1));
      brand1.click();
      driver.findElement(By.xpath("xpath for element")).click();
      driver.findElement(By.xpath("//[@id=\"Global_Size\"]")).click();
      WebElement Size = 
      driver.findElement(By.xpath("xpath for element")); 
      wait1.until(ExpectedConditions.elementToBeClickable(Size));
      Size.click();
      driver.findElement(By.xpath("//*[@id=\"Fit\"]")).click();
      driver.manage().timeouts().implicitlyWait(61, TimeUnit.SECONDS);
      driver.findElement(By.xpath("xpath for element")).click();
      driver.findElement(By.xpath("//*[@id=\"Fade\"]")).click();
      driver.manage().timeouts().implicitlyWait(61, TimeUnit.SECONDS);    
      [@id=\"applyFIlters\"]")).click();
       }
JeffC
  • 22,180
  • 5
  • 32
  • 55

1 Answers1

0

I just tried and this code works fine.

driver.get("https://www.jabong.com/");
        WebElement searchBox = driver.findElement(By.cssSelector("#search"));
        searchBox.sendKeys("men's black jeans");
        WebElement searchIcon = driver.findElement(By.cssSelector("#top-search-input > div.search-containter > span"));
        searchIcon.click();
        WebElement firstCheckBox = driver.findElement(By.id("boys"));
        firstCheckBox.click();
Arun Nair
  • 425
  • 3
  • 11