QTP fails to recognize Java-applet Jtree object when used with Regular Expression - applet

I am using QTP for automating an application. QTP recognizes Java applet- JTree as a html tag. In the html tag we have a number which is dynamic.
Hence we used Regular Expression so that QTP recognizes the object even if the number changes. But QTP is failing to do so. We have tested the regular expression in the evaluator and it works highlights the correct number as expected.
The expression in Obj Repository matches with the one in the Expert view.
Reg expressions do not work with html tags/applets is it??
Is there any other way to deal with dynamic elements in html tags??
Thanks in advance.

Try using descriptive programming it may help you. If you could provide more details of the issue then i could send you code snippet.

You should try UFT that is the next generation of QTP.
If you have a QTP-Licence you can update to UFT and I guess it will work well.
On the other hand how long will QTP will be supported

Related

Possibility of a multilanguage 'source' name with Twincat Eventlogger

Roald has written an excellent guide for the Twincat Eventlogger.
https://roald87.github.io/twincat/2020/11/03/twincat-eventlogger-plc-part.html
https://roald87.github.io/twincat/2021/01/20/twincat-eventlogger-hmi-part.html
For us this is exactly what we want, there is however 1 thing I haven't figured out. How to get the sourcename of the alarm in multiple languages in the HMI. params::sourceName gives the path in the software (example: MAIN.fbConveyor1.Cylinder1) This path can be customized when initializing the alarm (as Roald has shown). This doesn't work in my case, since I would like to define a generic alarm (example: "Cilinder not retracted within maximum time") that is instantiated multiple times.
I was thinking of using the source as a way to show the operator where the alarm occurs. We use this way (path) already for saving machine settings among other things. The machines we build are installed all over the world, so multilanguage is a must.
Beckhoff does support multilanguage alarm names (when defined), but the source is not defined, but dynamically generated.
Anyone have an idea how this problem can be solved?
If I understand your question correctly, then being able to parameterize the event text with information of the source of the problem should help you out.
If you define the event text as Cylinder {0} has not retracted in time. then you can add the arguments of that text during runtime.
IF bRaiseAlarm THEN
bRaiseAlarm := FALSE;
fbAlarm.ipArguments.Clear().AddString('Alice');
fbAlarm.Raise(0);
END_IF
However, since this also stated in the articles you mentioned, I am unsure if this would solve your problem.
'Alice' in this example, can be hard to localize. The following options come to my mind.
The string can be based on an ENUM. Enums can have textlist support, so if you add your translations there, that should allow multilingual output. However... this does require a lot of setup, placing translations inside your code, and making sure the PLC application is aware of the language that the parameter should use.
Use tags to mark the source device, as tags can be language invariant. It is not the most user-friendly method, but it could work for you. It would become something like: "Cylinder 'AA.1123' did not retract in time.". 'AA.1123' as a tag would have to be stored inside your PLC code as a string. You will have to trust that your operator can relate the tag back to the actual source.
Hopefully, this helped, or else please help me understand the problem better.

Validating parameters on Jasper report

When setting up parameters in Jasper Studio I cannot find a way to validate them. For example I have a string parameter but I want to ensure it is only numeric, or max length of 10, or not empty, etc. so when I try to run the report it stops me before it tries to call the SQL and shows an error instead?
I tried to use expressions and variables, and looked at scriptlets but they didn't seem to help and unless I'm searching wrong I can find nothing in the documentation or online. Surely parameter validation, even basic stuff, in a report or on the Server is a common action?
I appreciate when doing it via the API you provide your own, but when using Studio to design for the Jasper Server there must be a way to include validation simply?
thanks for any help.

Auto fix common typo in eclipse

Lets say for example I write many times priavte instead private.
Is there a way to let Eclipse automatically fix my common typo?
Something like construct a map of my common typo to its desire fix,
and then just let Eclipse fix it without asking me about that.
Are there any other IDE\editors that have such support?
There is no builtin support for automatically changing strings. The closest to your request are the templates of the Java editor, but even those must explicitly be activated using CtrlSpace.
To get around your problem, I suggest simply not to write that much yourself. If you want to declare a private field, type just "pr" and hit CtrlSpace to invoke code completion. Eclipse can do code completion quite well, often even without any trigger characters (try it with an empty class file).

chrome detecting integer as NPVariantType_Double with npruntime plugin?

I am trying to call a function through javascript via my NPRuntime plugin
but when i pass an integer value to a function,chrome detects that as NPVariantType_Double while firefox is taking same as NPVariantType_Int32.
Can we do avoid this without modifying script to make sure that both firefox and chrome detects it as NPVariantType_Int32.
Short answer: no, not really. They will give it to you in the format that they decide to give it to you. I recommend you cast it to a int32.
If you're really worried about how it's going to come in and need the format to remain exactly the same, pass it as a string and use some form of lexical cast to convert it to the numeric format you need.
Remember that javascript is dynamically typed, so from their perspective it shouldn't matter. This is just one of those annoying things :-/ FireBreath "solves" this issue simply by not caring what the browser provides and converting it to the datatype the function says it expects.
Taxilian is right. Chrome and Opera(as far as I recall) are returning mainly NPVariantType_Double , even if this represents the location of an element (in pixels).You can create a function that converts NPVariantType_Double and NPVariantType_Int32 to whatever you want.

The driver.findelement don't find the tab element:

i have this Problem with my test ..the
driver.findElement(By.xpath("//html/body/div[2]/div/div/div[2]/div[2]/div/div[2]/div/div/div/div/div/div/div/ul/li[2]/a[2]/em/span/span/span")).click();
don't find the element.
the eclipse show this message of error
Cannot locate a node using
//html/body/div[2]/div/div/div[2]/div[2]/div/div[2]/div/div/div/div/div/div/div/ul/li[2]/a[2]/em/span/span/span
EDIT : Post edited to reflect answer to actual problem. Original answer follows.
Long XPath expressions are fragile, and tests are prone to fail when relying on them : a completely unrelated change somewhere else in the document can mess everything up, and even if you're aware of the problem, the tests' code is just harder to maintain.
In this particular case, since the site is generated by GWT, it's even worse - there is little control over the actual HTML changes. A good solution when using GWT is to use the ensureDebugId method (see link in comments).
Are you sure that this XPath expression is correct ? Does other tests work with this driver ?
I'd recommend avoiding the use of long XPath expressions like that - wouldn't it be safer in the long term to start the expression at an id-specified div somewhere in the page rather than at the root of the DOM ?