Unknown random error in the end of test execution

Hello,

The problem is that sometimes (randomly) in the end of test execution we receive next exception in selenium log:

{“message”:“Failed to convert value of type ‘java.lang.String’ to required type ‘java.lang.Long’; nested exception is java.lang.NumberFormatException: For input string: “file””,“statusCode”:400}

I cannot catch this error because of it’s totally randomly.
Does anybody has some ideas what is this and how to fix it?

NumberFormatException occurs when u try to change the format of a Wrapper Class reference variablee.g. String to a number which is of type Integer,Long,Float etc (Wrapper classes of JAVA)

So you must be converting a String to a Long, string may be dynamic like filePath, sometime it forms correctly sometimes it forms incorrectly

You can try like this
try {
long l = Long.parseLong(str);
}
catch(NumberFormatException e){
e.printStackTrace();
}

Thanks, I know what is NumberFormatException :slight_smile: And the main reason why I put the problem in here - that I’m using python based framework and don’t have Java code at all. And I don’t have any moment in the code where I want to convert one type to another. So. it might be something from Appium or Selenium side.

Please provide more information what you are trying to do and with what setup.