FileUtils not showing suggestion to import predefined class for Screenshot functionality in selenium WebDriver

前端 未结 3 1874
小鲜肉
小鲜肉 2021-01-15 15:46

I am not allowed to use FileUtils in the program and error is shown when doing so. Even no suggestion is showing to import this pre-defined Class. I tried to search the solu

3条回答
  •  盖世英雄少女心
    2021-01-15 16:35

    Yes with Selenium Latest version we should use FileHandler.copy() It works and doesn't throw any error.

    // Take Screenshots example
    File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
    FileHandler.copy(scrFile, new File("\\screenshot.png"));
    

提交回复
热议问题