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 8230553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:10:42+00:00 2026-06-07T17:10:42+00:00

I need to take snapshot of webpage and for that I am using selenium

  • 0

I need to take snapshot of webpage and for that I am using selenium RC (this is good choice right ? )with eclipse for java language . I am using it as JUnit test case . Here is my code.

package com.example.tests;

import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.regex.Pattern;

@SuppressWarnings("deprecation")
public class mainClassTest extends SeleneseTestCase {
    @Before
    public void setUp() throws Exception {
        selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.gmail.com/");
        //water= new DefaultSelenium("localhost", 4444, "*firefox", "http://www.gmail.com/");
        selenium.start();

    }

    @Test
    public void testFinalSelenium() throws Exception {


        selenium.windowMaximize(); 

        selenium.open("/");
        selenium.waitForPageToLoad("30000");


        System.out.println("laoded\n");
    //  selenium.wait();
         selenium.captureScreenshot("C:\\test\\simpleQuora.png");
         selenium.captureEntirePageScreenshot("C:\\test\\CompleteQuora.png", "");
    }

    @After
    public void tearDown() throws Exception {

        selenium.stop();

    }


}

And it’s working fine but If i have to take snapshot of multiple URLs, then what are the ways to do that ?
Can we do it without using it as JUnit test case and using selenium in main function ?

Because if I try to run this code :

package com.example.tests;

import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;

public class MainClass {


    void func(String url, String file)
    {
        Selenium selenium = new DefaultSelenium("localhost", 4444, "*firefox", url);
        selenium.start();

        selenium.windowMaximize(); 

        selenium.open("/");
        selenium.waitForPageToLoad("30000");


        System.out.println("laoded\n");
    //  selenium.wait();
        String file1= "C:\\test\\"+file+".png";
        String file2= "C:\\test\\"+file+"2.png";
        selenium.captureScreenshot(file1);
        selenium.captureEntirePageScreenshot(file2, "");

        selenium.stop();

    }


    public static void main(String[] args)
    {

        MainClass demo = new MainClass();

        demo.func("www.facebook.com","face"); 

        //demo.func("www.reddit.com","reddit"); 

    }
}

I got this error.(Although I have started server from cmd).

  • 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-07T17:10:43+00:00Added an answer on June 7, 2026 at 5:10 pm
        demo.func("www.facebook.com","face"); 
    

    changes to

        demo.func("http://www.facebook.com","face"); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to take complete snapshot of a page using vbscript, and to do
How to take cassandra snapshot without nodetool but by java api only? I need
Using DSPack, Delphi XE I need to take a snapshot from a webcam and
I need to take a variable that contains a URL, and check to see
I need to take snapshot if command prompt window running in full screen mode.
I need take an old software that was built in 4D 2004 (you probably
I'm making a Mac OSX program where I need to take a snapshot (image
Need: take in XML and save data to database. Currently using: JAXB to convert
Are there any good tools to take a snapshot of my Azure tables and
I'm using an algorithm to take a snapshot from a bluetooth scatternet on Android

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.