0

エラー org.openqa.selenium.ElementNotVisibleException: Element is not currently visible が発生したため、操作できない可能性があります。どうすれば解決できますか?

4

2 に答える 2

0

If it's not visible while the WebDriver is looking to interact with the drop down then:

1st-) You should increase the implicit wait time, until any controller appears in the UI:

public Accesor(WebDriver driver,String url){
    this.driver = driver;
    this.driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
    driver.get(url);
}

2nd-)Try waiting until that specific element appears (but i wouldnt recommend that): WebElement cBoxOverlay = wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.id("cboxOverlay"))));

3rd-) If it's a real bug of the application and the UI does not show the dropdown you are looking for that is suppose to be there then try handling those kind of exceptions by taking a screenshot of the screen and trying with the next testcase or testsuite:

public void takePicture(){
    File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
    // Now you can do whatever you need to do with it, for example copy somewhere
    try {
        FileUtils.copyFile(scrFile, new File("c:\\tmp\\"+ getClass().getName().substring("com.automation.testsuite.".lastIndexOf(".")+1) + ""+new Date().toString().substring(0,10)  +".png"));
    } catch (IOException e) {

        e.printStackTrace();
    }
于 2013-07-30T13:14:05.120 に答える