Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 陈旧元素异常、元素不可单击、元素单击被拦截&;同一元素交替显示的元素错误不存在_Java_Selenium Webdriver_Testautomationfx - Fatal编程技术网

Java 陈旧元素异常、元素不可单击、元素单击被拦截&;同一元素交替显示的元素错误不存在

Java 陈旧元素异常、元素不可单击、元素单击被拦截&;同一元素交替显示的元素错误不存在,java,selenium-webdriver,testautomationfx,Java,Selenium Webdriver,Testautomationfx,我正在尝试选择使用自动化(Firefox)中可用的多个文件管理器 但是,在选择第一个选项(性别)后,我无法继续 我面对元素click被截获并尝试了Fluent Wait,这导致了陈旧的元素异常 如果删除Fluent wait或使用隐式wait,有时会发现元素异常 更让人困惑的是,有时代码可以在没有任何等待的情况下正常运行,并且我可以选择多个选项,但这种情况很少见 public void case9() { driver.get("https://www.jabong.com/");

我正在尝试选择使用自动化(Firefox)中可用的多个文件管理器

但是,在选择第一个选项(性别)后,我无法继续

我面对元素click被截获并尝试了Fluent Wait,这导致了陈旧的元素异常

如果删除Fluent wait或使用隐式wait,有时会发现元素异常

更让人困惑的是,有时代码可以在没有任何等待的情况下正常运行,并且我可以选择多个选项,但这种情况很少见

 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();
       }

我刚试过,这段代码很好用

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,选择性别不是问题。请尝试从所有/大部分类别中选择一些选项,然后应用过滤器。针对Ex品牌、尺码、褪色度、腰围等至少选择5-6个类别