Text field values in robot framework using selenium - selenium

I am using Robot-framework selenium2.0.
In the robot test I made, it fills out a form and save it. In the form, I have to put some numeric values in some text boxes but somehow the previous\default value of 0.0 is not removed from any of the box. When I run the test normally it puts the values after 0.0. For example I want to put 50 in the box but the test puts 50 after 0.0 so it becomes 0.050 and when it switches to next text box the value becomes NaN.
Here is how I am doing it,
wait until element is visible text_field
click element text_field
input text text_field 50
Is there any ascii codes that can be used to select values (ctrl+a) and delete the values first and then use input text to input values?

You can try:
Clear Element Text text_field
More on this here.
You could also use Selenium directly:
driver.findElement(By.id("text_field")).clear();

This may be work for you:
driver.findElement(By.id("text_field")).click()
driver.findElement(By.id("text_field")).pressKey('Ctrl' + 'A')
driver.findElement(By.id("text_field")).pressKey('Delete')
more Press Key here

Related

What code to use for Access VBA to allow a form to calculate a text response?

I have a generic access database and would like to get the most out of it.
I have created a form (formData_Header) that contains a sub-form (formData_Sub). The sub-form contains text boxes for items to be inventoried, along with data (numbers) from scans that correspond with these items. Each item will have 2 text boxes (count1 and count2) The header of the form contains text boxes that will be applied to all boxes in the sub-form, such as the values from instrument backgrounds. The background will have 2 text boxes (bkg1 and bkg2).
If I haven't lost you yet, I am wanting to take the background values from the header and the count values from the sub-form and calculate a text response in an other text box or Combo Box located in the sub-form.
i.e.: If bkg1 + bkg2 > count1 + count2then the output is "FAIL"
If bkg1 + bkg2 = count1 + count2then the output is "RE-evaluate"
All else output is "OK"
I have tried to do this multiple ways and each time, I get a random error, or the code does nothing.
Create a custom function that is called from the after update event on each control.
It needs to first check if each control/param has a value in it. If not, return the default "FAIL" value, otherwise use the calcs you show above.
If you put the function in the main form code, use this format to put the result into a subform control:
Me.formData_Sub.Controls("txtResult") = strCalculatedResult
If your code is on the subform, write the result into the control with the usual:
Me.ControlName = strCalculatedResult

Setting Default Values to Drop Down in Orbeon Form Builder

I have a autocomplete field:
I need to set the default value selected for this dropdown using another control value as shown in:
This control is passed to the form load as shown in:
For example if use cost center is 110 as shown in:
Then the default selected value of the Site lookup dropdown needs to be as shown in:
The tricky part is that your Site-Item field isn't a dropdown but an autocomplete. An autocomplete doesn't know all the possible label/values, but can only find some label/values doing a search by label. So you can't tell an autocomplete "set your value to 110", because it doesn't know what the label corresponding to 110 is.
If you knew the label, you could do this programmatically with an fr-set-label, but here you don't have the label but the value. You can read more about this in the section Setting by value. So, my advice is to use a Dynamic Data Dropdown instead of an Autocomplete field.

How to enter values in two different text box with same attributes?

Snippet
I used this code
driver.findElement(By.xpath("(//input[#type='number'])[1]")).sendKeys("20000");
driver.findElement(By.xpath("(//input[#required='required'])[2]")).sendKeys("3000");
But when it enter value of second textbox the value of first also changes.

Set text box value in Word VBA

I have a Word 2010 form template with various text boxes, combo lists and radio buttons. I wish to take the value from one text box and insert it as the value of another text box when a Save button is invoked. I have extracted the value from the source text box with the code below but how do I then insert it as the value of the target text box? I have tried a few things including the reverse of the code below but so far without success.
srp = ActiveDocument.SelectContentControlsByTag("RPI").Item(1).Range.Text
The Range.Text property is read/write. So you use the exact reversal of the code you have.
srp = ActiveDocument.SelectContentControlsByTag("RPI").Item(1).Range.Text ' Read
ActiveDocument.SelectContentControlsByTag("SRP").Item(1).Range.Text = srp ' Write

Is their any CharacterUpDown Control in vb.net

In VB Win-forms Application a NumericUpDown Control is used for only to scroll numbers. Its definition is:
The Windows Forms NumericUpDown control looks like a combination of a text box and a pair of arrows that the user can click to adjust a value. The control displays and sets a single numeric value from a list of choices. As Shown here.
I want to use strings instead of numeric values. For example, Grades: "A","B","C", etc. I think I will need to use UserContorl to code another custom "StringUpDown" Control.
You can't add String values to Numeric Drop down. instead for this you can use DomainUpDown here is the code to place a DomainUpDown in your form that contains A - Z characters
Dim domainUpDown1 As DomainUpDown
domainUpDown1 = New System.Windows.Forms.DomainUpDown()
For i As Integer = 65 To 90
domainUpDown1.Items.Add(Chr(i))
Next
Controls.Add(domainUpDown1)
Note : This control is available in Tool box also
You can change values using the ByRef=""
e.g. RefValues="Red;Blue;Green;Brown"
Hope this is what you were looking for
Link: mindStick