Send Keys on File Upload dialog throws org.openqa.selenium.json.JsonException, message: 'Unable to determine type from: H. Last 1 characters read: - selenium

I am finding hard time in handling file upload using selenium on my Linux machine. This is my browse web element
Below is the code
final LocalFileDetector detector = new LocalFileDetector();
final File localFile = detector.getLocalFile(filePath);
if (element instanceof RemoteWebElement) {
((RemoteWebElement) element).setFileDetector(detector);
}
final String absolutePath = localFile.getAbsolutePath();
element.sendKeys(absolutePath)
I am facing the error as org.openqa.selenium.json.JsonException, message: 'Unable to determine type from: H. Last 1 characters read: HBuild info: version: 'unknown', revision: 'unknown',time: 'unknown'
Can someone help on this ?

Related

Screenshots are not visible in klov reports

Screenshots are not getting uploaded in klov report :
Getting below warning :
[testng] Jul 05, 2018 12:34:29 PM com.aventstack.extentreports.mediastorage.HttpMediaManagerKlov storeMedia
[testng] WARNING: Unable to upload file to server C:\V2AutoWK/temp//screenshots/HLT_01--Failed_AT-VerifyTitle--0507_123427_PM(IST).png
The file is getting saved in db but unable to upload in klov report.
Any help is appreciated!
Check your File Path : C:\V2AutoWK/temp//screenshots/HLT_01--Failed_AT-VerifyTitle--0507_123427_PM(IST).png
Which seems incorrect slashes with combination of Forward and Backward slashes.
The effective way is, You can store image within your project folder by absolute path.
public void takeScreenShot(String SSName) throws Exception
{
File screen = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
BufferedImage img = ImageIO.read(screen);
File filetest = Paths.get(".").toAbsolutePath().normalize().toFile();
ImageIO.write(img, "png", new File(filetest + "\\Screenshots\\" + " - " + SSName + ".png"));
testlog.info("Details of " + SSName, MediaEntityBuilder.createScreenCaptureFromPath(System.getProperty("user.dir") + "\\Screenshots\\" + " - " + SSName + ".png").build());
}
Screenshot is fetched by ExtentReport method. You can find similar for klov.
This is a bug reported here: https://github.com/anshooarora/klov/issues/45
Hope that will be fixed soon!
Update: a fix has already been released with 3.1.6-SNAPSHOT.

Documentum error : [DM_SESSION_E_RPC_ERROR]

I am trying to get the content of all the documents (current version) from a documentum source using the following code
IDfSysObject document = (IDfSysObject) session.getObject(new DfId(eachFileMetadata.get(some document id).toString()));
ByteArrayInputStream docContent = document.getContent();
I am getting the following error:
DfIOException:: THREAD: Thread-585; MSG: [DM_SESSION_E_RPC_ERROR]error: "Server communication failure"; ERRORCODE: 100; NEXT: null
at com.documentum.fc.client.DfIOException.newCommunicationFailureException(DfIOException.java:16)
at com.documentum.fc.client.impl.connection.netwise.AbstractNetwiseRpcClient.receiveMessage(AbstractNetwiseRpcClient.java:193)
at com.documentum.fc.client.impl.connection.docbase.netwise.NetwiseDocbaseRpcClient.getBlock(NetwiseDocbaseRpcClient.java:1042)
at com.documentum.fc.client.impl.connection.docbase.DocbaseConnection.getBlock(DocbaseConnection.java:1475)
at com.documentum.fc.client.impl.connection.docbase.RawPuller.getBlock(RawPuller.java:52)
at com.documentum.fc.client.content.impl.BlockPuller.nextBlock(BlockPuller.java:49)
at com.documentum.fc.client.content.impl.PullerInputStream.getNextBuffer(PullerInputStream.java:73)
at com.documentum.fc.client.content.impl.PullerInputStream.ensureBufferHasData(PullerInputStream.java:63)
at com.documentum.fc.client.content.impl.PullerInputStream.read(PullerInputStream.java:88)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
at com.documentum.fc.impl.util.io.StreamUtility.copyContents(StreamUtility.java:50)
at com.documentum.fc.impl.util.io.StreamUtility.copyContents(StreamUtility.java:30)
at com.documentum.fc.client.DfSysObject.getContentEx3(DfSysObject.java:1952)
at com.documentum.fc.client.DfSysObject.getContentEx2(DfSysObject.java:1942)
at com.documentum.fc.client.DfSysObject.getContent(DfSysObject.java:1932)
at com.documentum.fc.client.DfDocument___PROXY.getContent(DfDocument___PROXY.java)
the above error occured when I am trying to get the content of a document,can anyone please help me??

Unable to update unidata from .NET

I've been attempting for the last couple of days to update unidata using sample code as a basis using .NET without success. I can read the database successfully and view the raw data within visual studio. The error reported back is a out of range error. The program is attempting to update the unit price of a purchase order.
Error:
{" Error on Socket Receive. Index was outside the bounds of the array.POD"}
[IBMU2.UODOTNET.UniFileException]: {" Error on Socket Receive. Index was outside the bounds of the array.POD"}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
HResult: -2146232832
InnerException: null
Message: " Error on Socket Receive. Index was outside the bounds of the array.POD"
Source: "UniFile Class"
StackTrace: " at IBMU2.UODOTNET.UniFile.Write()\r\n at IBMU2.UODOTNET.UniFile.Write(String aRecordID, UniDynArray aRecordData)\r\n at ReadXlsToUnix.Form1.TestUpdate(String PO_LINE_SHIP, String price) in c:\Users\xxx\Documents\Visual Studio 2013\Projects\ReadXlsToUnix\ReadXlsToUnix\Form1.cs:line 330"
TargetSite: {Void Write()}
failing Test Code is:
private void TestUpdate(string PO_LINE_SHIP,string price)
{
UniFile pod =null;
UniSession uniSession =null;
//connection string
uniSession = UniObjects.OpenSession("unixMachine", "userid", Properties.Settings.Default.PWD, "TRAIN", "udcs");
//open file
pod = uniSession.CreateUniFile("POD");
//read data
pod.Read(PO_LINE_SHIP);
//locking strategy
pod.UniFileLockStrategy = 1;
pod.UniFileReleaseStrategy = 1;
if (pod.RecordID == ""){
pod.UnlockRecord();
}
//replace existing value with one entered by user
pod.Record.Replace(4, (string)uniSession.Iconv(price, "MD4"));
try
{
pod.Write(pod.RecordID,pod.Record); //RecordId and Record both show correctly hover/immediate window
//pod.Write() fails with same message
}
catch (Exception err)
{
MessageBox.Show("Error" + err);
}
pod.Close();
UniObjects.CloseSession(uniSession);
}
}
Running on HP UX 11.31 unidata 7.2 and using UODOTNET.dll 2.2.3.7377
Any help greatly appreciated.
This is the write record version and have also tried writefield functionality with same error.
Rajan - thanks for the update and link. I have tried unsuccessfully to read/update my unidata tables using the U2 Toolkit. I can however read/update a file I have created within the same account. Does this mean there is a missing entry somewhere VOC, DICT for example.

Selenium RC PHPUnit test

My testcase crashes with the following error:
$this->open("/en");
$this->type("id=LoginForm_username", "seleniumfree");
$this->type("id=LoginForm_password", "seleniumfree");
$this->click("name=login");
$this->waitForPageToLoad("30000");
$this->click("link=Calendar");
$this->waitForPageToLoad("30000");
$this->click("link=Add to agenda");
$this->type("id=UserAgenda_date", "2013-10-10");
$this->select("id=UserAgenda_time", "label=01:00");
$note = $this->getEval("Math.floor(Math.random()*1000)").':note';
$this->type("id=UserAgenda_note", $note);
$this->click("name=yt0");
sleep(5);
try { //also tried with integer
$this->assertEquals("2", $this->getXpathCount("//input[#value='"+ $note + "']"));
} catch (PHPUnit_Framework_AssertionFailedError $e) {
array_push($this->verificationErrors, $e->toString());
}
Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/':
ERROR: Command execution failure. Please search the user group at https://groups.google.com/forum/#!forum/selenium-users for error details from the log window.
The error message is: The expression cannot be converted to return the specified type.
In firefox IDE, playing the test runs fine.Is there another way I can count the inputs by value?

How to convert PCM audio to TrueSpeech using NAudio

I am trying to convert a PCM 8 bit 8 KHz Mono file to DSP TrueSpeech 1 bit 8 kHz Mono using NAudio, and I get the following error:
A first chance exception of type 'NAudio.MmException' occurred in NAudio.dll
AcmNotPossible calling acmStreamOpen
I understand that there may be an intermediate step that I am missing -- any insight would be appreciated. Here is the code I am using:
WaveFormat outWaveFormat;
outWaveFormat = new TrueSpeechWaveFormat();
Debug.Print("Sample Rate: " + outWaveFormat.SampleRate); //displays "8000"
Debug.Print("Bit Rate: " + outWaveFormat.BitsPerSample); //displays "1"
FileInfo f = new FileInfo(inputFile);
String outputFileName = this.txtDest.Text + #"\" + f.Name;
using (WaveFileReader reader = new WaveFileReader(inputFile))
{
try
{
using (WaveStream convertedStream = new WaveFormatConversionStream (outWaveFormat, reader))
{
WaveFileWriter.CreateWaveFile(outputFileName, convertedStream);
}
}
catch (Exception ex)
{
Debug.Print(ex.Message);
}
}
Two reasons this might be happening:
you don't have a TrueSpeech encoder. I don't think newer versions of Windows include TrueSpeech anymore - it is effectively obsolete. You can run the NAudioDemo application to see what ACM codecs are on your machine.
your input format cannot convert to the target format in one step. Are you sure your input is PCM. Also I would expect that the TrueSpeech codec wants 16 bit input not 8 bit.
There is a third reason this can happen, although I don't think it affects TrueSpeech and that is that WaveFileWriter.CreateWaveFile assumes that AverageBytesPerSecond is an exact multiple of BlockAlign, which is not always true.