(Monte Media Library) Record screen im mp4 format - selenium

Below is Monte Media Library.
http://www.randelshofer.ch/monte/
I am using MonteScreenRecorder jar for record screen.
I am able to store video file in avi format but i want to store in mp4 format
Here is code for avi
import java.awt.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.monte.media.Format;
import org.monte.media.math.Rational;
import org.monte.screenrecorder.ScreenRecorder;
import static org.monte.media.VideoFormatKeys.*;
...
private ScreenRecorder screenRecorder;
public void startRecording() throws Exception
{
GraphicsConfiguration gc = GraphicsEnvironment
.getLocalGraphicsEnvironment()
.getDefaultScreenDevice()
.getDefaultConfiguration();
this.screenRecorder = new ScreenRecorder(gc,
new Format(MediaTypeKey, MediaType.FILE, MimeTypeKey, MIME_AVI),
new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,
CompressorNameKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,
DepthKey, 24, FrameRateKey, Rational.valueOf(15),
QualityKey, 1.0f,
KeyFrameIntervalKey, 15 * 60),
new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, "black",
FrameRateKey, Rational.valueOf(30)),
null);
this.screenRecorder.start();
}
public void stopRecording() throws Exception
{
this.screenRecorder.stop();
}
...
What are the change is required let me know.
Please Help
Thank you

Related

groovy.lang.MissingMethodException: No signature of method: is the following error while uploading a file using robot class

I am trying to upload a file from my local machine using robot class but I am getting the following error.
groovy.lang.MissingMethodException: No signature of method: java.awt.datatransfer.StringSelection.positive() is applicable for argument types: () values: []
Possible solutions: notify()
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.checkpoint.Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testcase.TestCase
import com.kms.katalon.core.testdata.TestData
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable
import java.awt.Robot
import java.awt.Toolkit
//import java.awt.datatransfer.Clipboard
import java.awt.datatransfer.StringSelection
import java.awt.event.KeyEvent
public class RobotClass {
#Keyword
def uploadFile(TestObject to, String filePath) {
WebUI.click(to)
StringSelection ss = new StringSelection(filePath);
//r=java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
println "The copied path is" :+ss
/* Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
// clipboard.setContents(ss, null);*/
println "The clipboard is " +clipboard
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
Robot robot = new Robot();
/*robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);*/
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyRelease(KeyEvent.VK_V);
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
}
=============================
Calling this tc:
CustomKeywords.'custom.RobotClass.uploadFile'(findTestObject('Object'), "Path")
You have a typo
println "The copied path is" :+ss
Should be
println "The copied path is:" + ss

usermodel is accessible from more than one module poi, poi.examples

I am getting an error on lines 9, 11, 13, 15 17 - The package org.apache.poi.hssf.usermodel is accessible from more than one module poi, poi.examples. I downloaded the latest poi jars and added them to module path. Please let me know where I went wrong?
package apachetests;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class Writetoexcel {
public static void main(String []args){
try {
// Specify the file path which you want to create or write
File src=new File("C:\\Users\\Venkat\\Desktop\\Hima2017\\Names.xlsx");
// Load the file
FileInputStream fis=new FileInputStream(src);
// load the workbook
XSSFWorkbook wb=new XSSFWorkbook(fis);
// get the sheet which you want to modify or create
XSSFSheet sh1= wb.getSheetAt(0);
// getRow specify which row we want to read and getCell which column
System.out.println(sh1.getRow(0).getCell(0).getStringCellValue());
System.out.println(sh1.getRow(0).getCell(1).getStringCellValue());
System.out.println(sh1.getRow(1).getCell(0).getStringCellValue());
System.out.println(sh1.getRow(1).getCell(1).getStringCellValue());
System.out.println(sh1.getRow(2).getCell(0).getStringCellValue());
System.out.println(sh1.getRow(2).getCell(1).getStringCellValue());
// here createCell will create column
// and setCellvalue will set the value
sh1.getRow(0).createCell(2).setCellValue("2.41.0");
sh1.getRow(1).createCell(2).setCellValue("2.5");
sh1.getRow(2).createCell(2).setCellValue("2.39");
// here we need to specify where you want to save file
FileOutputStream fout=new FileOutputStream(new File("location of file/filename.xlsx"));
// finally write content
wb.write(fout);
// close the file
fout.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
This is solved with the latest release.
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.0</version>
</dependency>

Getting phone call logs using API Bridge - J2ME

I'm trying to get to my nokia symbian S60 5th (NOKIA 5800) phone call logs using API Bridge. I followed the documentation from Nokia site but application doesn't work. The code is in Java ME. The problem is that I can't Initialize the API Bridge Midlet. This is the code. Thank you
package mobileapplication3;
import apibridge.*;
import apibridge.entities.*;
import com.sun.lwuit.*;
//
import java.util.*;
import java.util.Hashtable;
import java.util.Vector;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.location.Coordinates;
import javax.microedition.location.Criteria;
import javax.microedition.location.Location;
import javax.microedition.location.LocationException;
import javax.microedition.location.LocationProvider;
import javax.microedition.lcdui.TextBox;
//
/*import apibridge.LocationService;
import apibridge.LoggingService;
import apibridge.APIBridge;
import apibridge.HTTPManager;
import apibridge.MediaManagementService;
import apibridge.URLEncoder;
import apibridge.NewFileService;
import apibridge.entities.*;*/
import javax.microedition.midlet.*;
public class Midlet extends MIDlet implements CommandListener {
private Command exitCommand = new Command("Exit", Command.EXIT, 1);
private Command callLogCommand = new Command("Calllog", Command.ITEM, 2);
private final TextBox tbox = new TextBox("Result", "", 3000, 0);
public Midlet() {
tbox.addCommand(exitCommand);
tbox.addCommand(callLogCommand);
tbox.setCommandListener(this);
APIBridge apiBridge = APIBridge.getInstance();
apiBridge.Initialize(this);
tbox.setString("Prova ...");
}
A MIDlet doesn't get started by its constructor. It gets started by the startApp() method.
So try moving everything inside your constructor, into a function called startApp().
public Midlet() {
}
public void startApp() {
tbox.addCommand(exitCommand);
tbox.addCommand(callLogCommand);
tbox.setCommandListener(this);
APIBridge apiBridge = APIBridge.getInstance();
apiBridge.Initialize(this);
tbox.setString("Prova ...");
}
See if that helps.

SVG to PDF: PDFTranscoder convert only part of file

I use this code for convert SVG to PDF:
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import org.apache.batik.transcoder.Transcoder;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.fop.svg.PDFTranscoder;
public class SVGtoPDF{
public static void main(String[] argv) throws TranscoderException, FileNotFoundException {
Transcoder transcoder = new PDFTranscoder();
TranscoderInput transcoderInput = new TranscoderInput(new FileInputStream(new File("/tmp/test.svg")));
TranscoderOutput transcoderOutput = new TranscoderOutput(new FileOutputStream(new File("/tmp/test.pdf")));
transcoder.transcode(transcoderInput, transcoderOutput);
}
}
And this is working but little bit strange
This code convert to pdf only part of file - right top quarter
Somebody know why? And how to solve
Thanks

Java3D and Behaviours : KeyNavigatorBehaviour works fine, but not MouseRotate

I don't manage to give user mouse interaction to a ColorCube by using a MouseRotate. However, when i use a KeyNavigatorBehaviour, i can control the cube with keyboard as needed.
Here the code i used to test MouseRotate :
import javax.media.j3d.BoundingSphere;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.GraphicsConfigTemplate3D;
import javax.media.j3d.TransformGroup;
import javax.swing.JFrame;
import javax.vecmath.Point3d;
import com.sun.j3d.exp.swing.JCanvas3D;
import com.sun.j3d.utils.behaviors.mouse.MouseRotate;
import com.sun.j3d.utils.geometry.ColorCube;
import com.sun.j3d.utils.universe.SimpleUniverse;
public class MovingAroundCube extends JFrame {
private static final long serialVersionUID = 1L;
public MovingAroundCube(){
setTitle("Moving around cube");
setSize(300,300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
JCanvas3D jCanvas3D = new JCanvas3D(new GraphicsConfigTemplate3D());
jCanvas3D.setSize(300, 300);
add(jCanvas3D);
SimpleUniverse universe = new SimpleUniverse(jCanvas3D.getOffscreenCanvas3D());
universe.getViewingPlatform().setNominalViewingTransform();
universe.addBranchGraph(createSceneGraph());
}
public BranchGroup createSceneGraph() {
BranchGroup objRoot = new BranchGroup();
TransformGroup listenerGroup = new TransformGroup();
listenerGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
listenerGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
objRoot.addChild(listenerGroup);
//KeyNavigatorBehavior behaviour = new KeyNavigatorBehavior(listenerGroup);
MouseRotate behaviour = new MouseRotate(listenerGroup);
behaviour.setSchedulingBounds(new BoundingSphere(new Point3d(), 100));
listenerGroup.addChild(behaviour);
listenerGroup.addChild(new ColorCube(0.4));
return objRoot;
}
public static void main(String[] args) {
new MovingAroundCube().setVisible(true);
}
}
If I uncomment the line creating the KeyNavigatorBehaviour and comment the line creating the MouseRotate, user interaction this time is possible .
So, why can't the cube react to the mouse (when i use MouseRotate behaviour instance) ?
Any help will be appreciated.
System : Xubuntu 11.04
Java3D version : 1.5.2
There are two ways to solve this dilemma:
Use this constructor:
MouseRotate behaviour = new MouseRotate(jCanvas3D, listenerGroup);
or
Enable mouse events as long as no MouseListeners are added:
import java.awt.AWTEvent;
JCanvas3D jCanvas3D = new JCanvas3D(new GraphicsConfigTemplate3D()) {
{
this.enableEvents(AWTEvent.MOUSE_EVENT_MASK |
AWTEvent.MOUSE_MOTION_EVENT_MASK |
AWTEvent.MOUSE_WHEEL_EVENT_MASK);
}
};
Key events are enabled because 'setFocusable(true)' is set in JCanvas3D.
August, InteractiveMesh