Insert Text in Textfield with a Number as Id (Robotframework) - swing

I'm trying to insert some Text in a Textfield in a swing application via Robotframework. But it doesnt do anything.
The only idea why it does not work is that the id of the text box is a number. For other text fields with string as Id, it went smoothly. Do you have any Idea?
*** Variables ***
${stringkurzbesch} 110
Daten des Beschaffungsvorgangs
[Timeout] 15 seconds
Select Main Window
Select Context Daten des Beschaffungsvorgangs
Convert To String ${stringkurzbesch}
Insert Into Text Field ${stringkurzbesch} und hier eine Kurzbeschreibung
I only get a Timeout as Result
[java] Daten des Beschaffungsvorgangs | FAIL |
[java] Test timeout 15 seconds exceeded.

The reason why it does not work most probably is that RF tries to operate on the 111. element in the current locating context as specified here:
Most
of the keywords that operate on a visible component take an argument
named identifier, which is used to locate the element. The first
matching element is operated on, according to these rules:
If the identifier is a number, it is used as a zero-based index for the particular component type in the current context. Using
indices is, however, fragile and is strongly discouraged.
If the identifier matches to internal name of a component (set using setName method in Java code), that component is chosen.
For components that have visible text (e.g. buttons), identifier is also matched against that.
Text field keywords also support accessing awt-text fields by prefixing the identifier with awt=
Try ${stringkurzbesch} "110" or go for another locating method as described above.

Related

What is the difference between findBy with underscore and findBy without it?

Example: What is the difference between :
List<UserCompany> findByCompany_IdAndCompany_IsActivated(params)
and
List<UserCompany> findByCompanyIdAndCompanyIsActivated(params)
There is no difference if your model is unambiguous with respect to field names.
List<UserCompany> findByCompanyIdAndCompanyIsActivated(params) -
this first thinks that companyId and companyIsActivated are properties within UserCompany and tries to find them if fails
it then thinks that UserCompany has a field Company - which is another class and Company has field - Id and IsActivated and tries to find them
Where as the below thing
List<UserCompany> findByCompany_IdAndCompany_IsActivated(params)
assumes directly that UserCompany has a field Company - which is another class and Company has field - Id and IsActivated and tries to find them
From the spring documentation
Property expressions :---
Property expressions can refer only to a direct
property of the managed entity, as shown in the preceding example. At
query creation time you already make sure that the parsed property is
a property of the managed domain class. However, you can also define
constraints by traversing nested properties. Assume Persons have
Addresses with ZipCodes. In that case a method name of
List findByAddressZipCode(ZipCode zipCode); creates the
property traversal x.address.zipCode. The resolution algorithm starts
with interpreting the entire part (AddressZipCode) as the property and
checks the domain class for a property with that name (uncapitalized).
If the algorithm succeeds it uses that property. If not, the algorithm
splits up the source at the camel case parts from the right side into
a head and a tail and tries to find the corresponding property, in our
example, AddressZip and Code. If the algorithm finds a property with
that head it takes the tail and continue building the tree down from
there, splitting the tail up in the way just described. If the first
split does not match, the algorithm move the split point to the left
(Address, ZipCode) and continues.
Although this should work for most cases, it is possible for the
algorithm to select the wrong property. Suppose the Person class has
an addressZip property as well. The algorithm would match in the first
split round already and essentially choose the wrong property and
finally fail (as the type of addressZip probably has no code
property). To resolve this ambiguity you can use _ inside your method
name to manually define traversal points. So our method name would end
up like so:
List findByAddress_ZipCode(ZipCode zipCode);
Underscore is reserved character which allows you to point the right object to construct jpa query. It's used only with nested objects. For example if you would like to query by ZipCode inside Address inside you Company object.
More information can be found here

Make beam/dataflow Create.of(List<String>) node emit exactly the number of elements in the list

My beam/dataflow job starts with a single static entry passed in like this:
Pipeline p = Pipeline.create(options);
PCollection<String> initValue = p.apply(Create.of("MyStringValue"));
However when I run it (on DataflowRunner), the Create node produced by that statement emits multiple values. The longer I wait, the more times it emits the single value:
This doesn't appear to be an artefact as later in the pipeline I get duplicate/triplicate/.. elements. Beam also logs a warning:
Can't verify serialized elements of type BoundedSource have well defined equals method. This may produce incorrect results on some PipelineRunner
How do I make my Create.of with one value emit just one value to the pipeline?
Do I need to attach an equals method or point it towards the equals method for String values (if so, how)!?

Array Condition within EPA CEP PROTON

Using CEP Proton I want to check if, for the events received in a time interval, the id of the second and following events is contained in an attribute of type array coming in the first event. Let's say the first event is coming with the attribute called group that is an array of integers (10, 20, 30). The following events will come with an id, ex 20, 25 and so on. I want to check if the id of those events is included in the attribute group included in the first event.
For that I have created a condition in EPA
ArrayContains(ArrayGet(myevent.group,0),ArrayGet(myevent.id,ArraySize(myevent.id)-1))
However I'm getting an error when I click on verify
Error Error in EPA: expression error of undefined myepa
Am I doing anything wrong?
Cannot I access to the attribute array using ArrayGet? Or maybe ArrayContains cannot work with the result of ArrayGet?
JSON
{"epn":{"events":[{"name":"GupsyContextUpdate","createdDate":"Thu Sep 29 2016","attributes":[{"name":"entityId","type":"String","dimension":0},{"name":"entityType","type":"String","dimension":0,"description":"The cost of this event occurrence. Negative if this is an opportunity"},{"name":"SF","type":"Integer","dimension":0,"description":"Used in case the this event occur within an interval"},{"name":"occupied","type":"Integer","dimension":"0"},{"name":"framecounter","type":"Integer","dimension":"0"},{"name":"RSSI","type":"String","dimension":"0"},{"name":"hwversion","type":"String","dimension":"0"},{"name":"swversion","type":"String","dimension":"0"},{"name":"compassz","type":"String","dimension":"0"},{"name":"MACBS","type":"String","dimension":"0"},{"name":"SNR","type":"String","dimension":"0"},{"name":"devEUI","type":"String","dimension":"0"},{"name":"battery","type":"String","dimension":"0"},{"name":"devicetype","type":"String","dimension":"0"},{"name":"compassx","type":"String","dimension":"0"},{"name":"compassy","type":"String","dimension":"0"},{"name":"compasst","type":"String","dimension":"0"},{"name":"neighbours","type":"String","dimension":"1"},{"name":"timestamp","type":"String","dimension":"0"}]},{"name":"gupsyoutput","createdDate":"Thu Sep 29 2016","attributes":[{"name":"Certainty","type":"Double","defaultValue":"1","dimension":0,"description":"The certainty that this event happen (value between 0 to 1)"},{"name":"OccurrenceTime","type":"Date","dimension":0,"description":"No value means it equals the event detection time, other option is to use one of the defined distribution functions with parameters"},{"name":"ExpirationTime","type":"Date","dimension":0},{"name":"Cost","type":"Double","dimension":0,"description":"The cost of this event occurrence. Negative if this is an opportunity"},{"name":"Duration","type":"Double","defaultValue":"0","dimension":0,"description":"Used in case the this event occur within an interval"},{"name":"test","type":"String","dimension":"1"}]}],"epas":[{"name":"gupsyepa","createdDate":"Thu Sep 29 2016","epaType":"Aggregate","context":"gupsyct","inputEvents":[{"name":"GupsyContextUpdate","alias":"gupsyupdate","consumptionPolicy":"Consume","instanceSelectionPolicy":"First"}],"computedVariables":[{"name":"count","aggregationType":"Count","gupsyupdate":"ArrayContains(ArrayGet(gupsyupdate.neighbours,0),ArrayGet(gupsyupdate.id,ArraySize(gupsyupdate.id)-1))"}],"assertion":"count == true","evaluationPolicy":"Immediate","cardinalityPolicy":"Single","internalSegmentation":[],"derivedEvents":[{"name":"gupsyoutput","reportParticipants":false,"expressions":{"Duration":"0","test":"ArrayContains(ArrayGet(gupsyupdate.neighbours,0),ArrayGet(gupsyupdate.devEUI,ArraySize(gupsyupdate.devEUI)-1))"}}]}],"contexts":{"temporal":[{"name":"gupsyct","createdDate":"Thu Sep 29 2016","type":"TemporalInterval","atStartup":false,"neverEnding":false,"initiators":[{"initiatorType":"Event","initiatorPolicy":"Ignore","name":"GupsyContextUpdate"}],"terminators":[{"terminatorType":"RelativeTime","terminationType":"Terminate","relativeTime":"15000"}]}],"segmentation":[],"composite":[]},"consumers":[{"name":"gupsyconsumer","createdDate":"Thu Sep 29 2016","type":"Rest","properties":[{"name":"URL","value":"http://127.0.0.1/ProtonParser/TestEvent2Log.php"},{"name":"contentType","value":"application/xml"},{"name":"formatter","value":"xml"},{"name":"delimiter","value":";"},{"name":"tagDataSeparator","value":"="},{"name":"dateFormat","value":"dd/MM/yyyy-HH:mm:ss"}],"events":[{"name":"gupsyoutput"}]}],"producers":[],"name":"gupsy"}}
Please share the whole JSON definition of your application.
From the information you have provided it is not clear which type of EPA it is (to access a series of events you need a statefull EPA and you need to make sure you write the application in such a way as to be able to distinguish between the first and subsequent events).
Additionally it is not clear why you try to access the same event instance- myevent in both parts of the expression.
ArrayContains recieves (array, value) as operands.
You pass it (value, value), and thats assuming that "myevent.id" is also an array, which from your description I understood it is not?
Anyway, I see lots of potential problems with your expression, therefore I would like to see the whole JSON, or at least the part relevant to the "myepa" EPA.
I have reviewed the JSON application, there are multiple problems:
1)You are using an EPA of type aggregate, to calculate a COUNT. Count is for counting events. It is an integer variable. No boolean values can be assigned to it.
Therefore comparison expressions like "count == true"
Or assigment of boolean values like : "count : ArrayContains(ArrayGet(gupsyupdate.neighbours,0),ArrayGet(gupsyupdate.id,ArraySize(gupsyupdate.id)-1))"
Are not valid.
2)Additionally, assuming you use this expression somewhere, and not in count variable:
-the gupsyupdate event has no attribute "id", so you cannot use this in an expression.
-ArrayGet(gupsyupdate.neighbours,0) - will return a single object within an array... So you cannot use it in ArrayContains expression which is supposed to receive an array
3)The policies of the EPA doesn't make sense... It is an aggregation EPA, but you use it with evaluationPolicy of "Immediate" and cardinality policy "Single". That means this EPA will be evaluated only once, immediately as it receives the first gupsyupdate event. So it will not really act as aggregator....
Please revise your application according to this input.

ParseFloat html

I am a college student just learning HTML. The assignment that I have to complete is a simple grade calculator. There is a single button that calculates everything, and the values go to three empty text fields(total, average, and percentage). The problem that I am having is the total is calculated and shows up in the field, but the number is followed by [object]. The average field shows NaN and the percentage field remains empty. Here is my code.
<input type="button" value="Click to calculate"
onclick="fullmark = parseFloat(document.getElementById('fullBox').value);
science = parseFloat(document.getElementById ('scienceBox').value);
math = parseFloat(document.getElementById('mathBox').value);
computer = parseFloat(document.getElementById('computerBox').value);
english = parseFloat(document.getElementById('englishBox').value);
History = parseFloat(document.getElementById('historyBox').value);
total=science+math+computer+english+history;
average=(total/5);
percentage=(total/fullmark)*100;
document.getElementById('totalBox').value=total;
document.getElementById('averageBox').value=average;
document.getElementById('percentageBox').value=percentage;">
Since you wrote History as the variable name first, but then used history when computing/assigning the value for total, that is a different variable – identifiers in JavaScript are case sensitive.
The only reason you don’t get your script aborted with an error about an undefined variable at that point, is that window.history exists – it’s the object that keeps the current navigation history of the window. (All global variables are properties of the window object, so that’s what your use of history gets resolved to.) And since it’s an object, [object] is what you get as result when transferring it into a string context (which happens through the use of +, which is both the addition and the string concatenation operator).
Apart from that, writing all that code into an onclick handler is kinda terrible style. Go learn how to use proper functions for stuff like this next ;-)

Three rows of almost the same code behave differently

I have three dropdown boxes on a Main_Form. I will add the chosen content into three fields on the form, Form_Applications.
These three lines are added :
Form_Applications.Classification = Form_Main_Form.Combo43.Value
Form_Applications.Countryname_Cluster = Form_Main_Form.Combo56.Value
Form_Applications.Application = Form_Main_Form.Combo64.Value
The first two work perfectly but the last one gives error code 438!
I can enter in the immediate window :
Form_Applications.Classification = "what ever"
Form_Applications.Countryname_Cluster = "what ever"
but not for the third line. Then, after enter, the Object doesn't support this property or method error appears.
I didn't expect this error as I do exactly the same as in the first two lines.
Can you please help or do you need more info ?
In VBA Application is a special word and should not be used to address fields.
FormName.Application will return an object that points to the application instance that is running that form as opposed to an object within that form.
From the Application object you can do all sorts of other things such as executing external programs and other application level stuff like saving files/
Rename your Application field to something else, perhaps ApplicationCombo and change your line of code to match the new name. After doing this the code should execute as you expect.
Form_Applications.Application is referring to the application itself. It is not a field, so therefore it is not assignable (at least with a string).
You really haven't provided enough code to draw any real conclusions though. But looking at what you have posted, you definitely need to rethink your approach.
It's to say definitely but you are not doing the same. It looks like you are reading a ComboBox value the same (I will assume Combo64 is the same as 43 and 56) but my guess is that what you are assigning that value to is the problem:
Form_Applications.Application =
Application is not assignable. Is there another field you meant to use there?