Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9061113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:24:14+00:00 2026-06-16T15:24:14+00:00

I am getting failure exception while taking the device screenshots my code as below:

  • 0

I am getting failure exception while taking the device screenshots

my code as below:

//open the page
driver.get("http://wikipedia.com");
//take another screenshot
try {
        File screenshot = new File("screenshot1.png");
            File tmpScreenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);           
        }
        catch(IOException e){
            System.out.println("Failed to take screenshot."+e.getMessage());
        }

        //quit
        driver.quit();
    }

Can any body help me out this issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T15:24:15+00:00Added an answer on June 16, 2026 at 3:24 pm

    I tried to execute your code but didn’t get the exception, although i didn’t get the screenshot either. I have modified your code a bit see if this work for you

    driver.get("http://wikipedia.com");
    
    File screenshot = new File("screenshot1.png");
    File tmpScreenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
    org.apache.commons.io.FileUtils.copyFile(tmpScreenshot, screenshot);
    System.out.println("the screenshot printed at:- " + screenshot.getAbsolutePath());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting the following failure message when i build on the below two
Iam getting a null pointer exception while sending some string text as an sms
I'm getting an exception randomly with the Send method shown below. The exception I'm
Getting the following error/exception while trying to compile my maven based web application... can
I'm still getting Failure sending mail. exception. The inner exception is Unable to connect
I am getting a COM Exception while binding ListView to a List items. The
I'm getting General Failure when I call processShipment method in using fedex shipping service,
I keep getting an out of memory failure when I try to do the
Getting message expected identifier in red for below these two statements } else if
Getting 'Dispatcher has no subscribers' error while trying to post message to a channel

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.