'The operation can not be performed' - Error message in QTP - java

I am using QTP to automate a Java Application.
With the following code, I am trying to maximize a JavaWindow which is simply taken from QTP's record and playback.
JavaWindow("MyAppWindow").Maximize
This code is working fine in most of the cases. But, at some rare cases, it turned out to be a failure. QTP is throwing an error as "The operation can not be performed"
I stopped the QTP execution and tried to record one more time for the JavaWindow to get maximized. Surprisingly, QTP is not generating any code for any sort Window events to the JavaWindow. If I do any close or click in any of the elements in that window, then it is working fine.
Why this strange behavior ? How to avoid these sort of errors ?

Related

Repast error when doing Batch run, ERROR: InstanceRunner - Error while running model

I have set up a simulation in Repast that is supposed to model people boarding an airplane. I wish to run it multiple times to get an average of how much time it takes to board the airplane for various methods. The model works completely fine when running normally, and the model output works just fine then. However, when I try to do a batch run it gives me this error in the console, and the final model output it gives is just an empty file. Also, the console gives this message:
WARN [SwingWorker-pool-2-thread-2] 17:40:56,274 OutputFinder - No model output found matching glob:{**/,}ModelOutput*.batch_param_map.txt in /var/folders/nh/8k546jq14l5gnwkjgxvch8180000gn/T/simphony_model_1651246794058/instance_2
WARN [SwingWorker-pool-2-thread-2] 17:40:56,274 OutputFinder - No model output found matching glob:{**/,}ModelOutput*.txt in /var/folders/nh/8k546jq14l5gnwkjgxvch8180000gn/T/simphony_model_1651246794058/instance_2
WARN [SwingWorker-pool-2-thread-2] 17:40:56,275 OutputFinder - No model output found matching glob:{**/,}ModelOutput*.batch_param_map.txt in /var/folders/nh/8k546jq14l5gnwkjgxvch8180000gn/T/simphony_model_1651246794058/instance_1
WARN [SwingWorker-pool-2-thread-2] 17:40:56,275 OutputFinder - No model output found matching glob:{**/,}ModelOutput*.txt in /var/folders/nh/8k546jq14l5gnwkjgxvch8180000gn/T/simphony_model_1651246794058/instance_1
From what I have seen, there could be four issues why a model doesn't work in batch when it works normally.
It doesn't self-terminate.
However, I am certain my model does this, it terminates as soon as all passengers are seated, and I know it does this in all normal runs.
Display elements
I have removed the display, and have no display elements in my simulation
Model output
My model output is written to a file ModelOutput.txt, with the same name each time, and it works fine when running normally.
External libraries
This is what I believe might be the issue. The only libraries I am importing are standard java libraries such as java.util.Random or java.util.list, as well as a lot of repast libraries. Could any of these be the issue? If so, how do I move them somewhere else while still being able to access them? I saw something about moving them into the lib directory but didn't quite understand how.
Thank you for any help!
This error results when using a JRE > 11. (Note that when doing a batch run, the first "java" in the PATH is used which may not be what Eclipse is using.)
See the FAQ entry here for a solution:
https://repast.github.io/docs/RepastFAQ/RepastFAQ.html#_fatal_java_lang_exceptionininitializererror_caused_by_java_lang_reflect_inaccessibleobjectexception
The arguments specified there can be added in the JVM Arguments text box in the batch run GUI.

JUnit Eclipse Oxygen - Display stack trace on test failure?

Is there a way to have eclipse show junit assertion errors (or more generally unhandled exceptions during testing for that matter) automatically without me going to the junit window, selecting the failed test, clicking the corresponding line on the right side, and then clicking the corresponding button each single time? This is ludicrous. There surely must be a better way I have not found yet!

Drag operation on JavaSlider object using QTP/UFT works with breakpoint but fails without

I use Drag method on a Java Slider with some number as argument. It fails to work during execution. But always works with breakpoint. Any setting to make QTP simulate execution behavior of breakpoint.
Please note that application is thick client Java.
I've come across this problem in the past and I found it was because QTP/UFT was getting ahead of its self. This might seem primitive but I had a sync (to ensure that your application has displayed the expected page), put a couple of second wait, check that 'Slider' exists and then attempt an action on it.

Re-run script upon obtaining error on a webpage

I am using Selenium WebDriver to automate the downloading of videos from a few online video converting sites.
Basically, all the user has to do is enter the URL of a YouTube video and the program will run the script to download the videos for you.
Everything runs very smoothly, but the problem is when the website fails to convert the video.
For example, clipconverter.cc sometimes throws an "Unable to get video infos from YouTube" error, but it works when you try again.
I have done some error checking in the event that there are missing elements and the program will stop running the script but in the example I mentioned above, I want to re-run the script again.
What is a possible way of achieving this? Do I have to re-create the error page and get the elements presented there?
Since you are not using Selenium as your test engine, but as a web scraper - IMHO it's actually a matter of your workflow to handle such states. This could be a corner case of a Defensive programming, but still can design it to handle such scenarios when/if they happen.
What is a possible way of achieving this? Do I have to re-create the error page and get the elements presented there?
Once you detect such error message (via the Selenium's functionality)
when the website fails to convert the video
you can call the same piece of code that handled the first request, but this time just pass the parameters you already have (videoURL, user etc.). In case you re-try and this site still fails, you can ask another one to carry out the download (as a failover scenario).
For the design I would use a mixture of
Command to take care of the user requests/responses
Observer to notify me for the changes
State for altering the behavior when the downloading process internal state changes

t.replace is not a function in selenium RC

I am using selenium 2.25 with firefox 3.6 and I am facing issues when i run my scripts.
Below is the error in my console and system displaying alert message as "Type error $j undefined"
ERROR: Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window. The error message is: t.replace is not a function
May I know what is the problem here, the scripts which I used were running fine earlier, but from last week eclipse showing error as above when I run my scripts.
Selenium version:2.25
OS:Windows 7.0
Browser:Firefox
Browser version:3.6
t.replace is not a function is normally caused by trying to perform a replace on a null in JavaScript.
I suspect you are trying to interact with something on the page before all the JavaScript has finished loading and this is causing the error. This will be intermittant because sometimes the page will have fully loaded and the JavaScript on the page will have processed correctly. whilst at other times Selenium may get in there a bit too quickly.
Generally have your devs check their javaScript code, there is a path that results in a replace being performed on a null. They should have some code to protect against things like this, it's caused by bad quality code.
Basically you have found a bug.

Categories