← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #260979]: How to get specific location/controller/element screenshot using sikuli with robot and java and webdriver

 

Question #260979 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/260979

Description changed to:
My code is given below

WebDriver de = new FirefoxDriver();
		
		 
		de.get("https://https://www.google.co.in";);
		
		de.manage().window().maximize();

               
              WebElement pi_logo = de.findElement(By.id("hplogo"));

Point co = pi_logo.getLocation();
		
		Dimension od = pi_logo.getSize();
           
                
             System.out.println(co);
		
		Integer  xcor = co.x;
		
		Integer yor= co.y;
		
		
		System.out.println("the value of x and y co ordinates are" + xcor + " and y are"+ yor);

               	Robot robot = new Robot();
		
		BufferedImage 	myScreenshot  = robot.createScreenCapture(new Rectangle(xcor,yor));
		
                 
               ImageIO.write(myScreenshot, "jpg", new File("D:\\myScreenshot.jpg"));

              pi_logo.click();

               de.close();

The problem is that code is not capturing Google India image as a screenshot but rather some different screen
if I use below code then its capturing entire page but not specific only Google india image
BufferedImage myScreenshot =  robot.createScreenCapture( new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
,how with the help of sikuli i can get solution done? Expert, pls advise, pls note cant use sikuli ide with its capture screenshot button/icon as need to integrate with webdriver,robot

Best Regards,

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.