How to clear a text field using Robot Framework? - automated-tests

I'm using the Sikuli Library with Robot Framework to run tests for a local windows application. Most solutions online are selenium based but I believe that only to work for web applications.
Entering text has been fine for the empty fields when there isn't a default value concerned.
Currently, I'm dealing with a field that contains a default value of 5000 but I need to change it to 10.
Text Field:
So far I've tried things such as:
Double-clicking the field first to highlight then type over (Input Text single clicks and removes highlight anyway)
Single-Clicking as Input text single clicks itself (Does not happen fast enough to simulate a double click)

I will answer in Sikuli terms. You just execute Ctrl+a to select content of the cell and then type 10
type('a', KeyModifier.CTRL)
type('10)

Related

(Robot Framework IDE) RIDE->Search Tests Window-> Search tab what is "ADD all to Selected" used for

As the title says, in RIDE interface for Robot Framework, on the Search Tests Window, i have two Tabs:
1-Search 2- Add All to Selected
For first Tab, i wonder if i can insert a list of Test cases on search box and if the second TAB
will tick them on the interface.
I couldn't use it in this way but seems to function like that.
Any idea?
Edit:
So here i have added two complete test names separated with comma followed by space:
but as you see the Search Engine finds only the last test name. I can search by what i have added as TestID inside Documentation of each test,and add something like :
TC-69, TC67 but search engine finds as before only the last test.
You don't mention what version of RIDE you are using. In the past there was a bug on that search feature.
Today I have verified that Search function is working as expected on RIDE version 2.0b2, in Windows 10, Python 3.9 and wxPython 4.1.1.
I used a list in the Search box and then Add All to Selected. I use a large test name and a partial test name:
9__Checks if all the firewall rules related to the Network Discovery group are disabled, 2_
Here is a partial capture of the dialog (not the best colors combination ;) :
EDIT: Please edit the search text to not include the word Acces or Accès, so it is only Contextuel_REFSITE.
Another problem (could be a bug in RIDE) is the documentation having latin characters, and the search function become broken.
The tab Tag Search, will only search by tags, and then you have the option to add to Included or to Excluded tests.
Note: It is very important to confirm the version of RIDE you are using (Tools->View RIDE Log).

How to find all SO10 text modules used in an SAP Adobe Form?

How do I find all the text modules used in an Adobe Form? Is there a table somewhat like TADIR where I could type in the Adobe Form name and the object names (text modules) for that form name will appear?
My answer regarding Smart Forms is perfectly valid for Adobe Forms too. Adobe Forms also have SO11 text elements hard-coded in the form FM code. The only difference is link between Adobe form FM and Adobe form INCLUDE: for some reason there is no link for them in the D010INC table.
However, as your intention is to find text elements of a single form, and not mass searching, you can find out the INCLUDE manually.
Find out Adobe form function module name. You can do this either manually (Test button in SFP tcode)
or via the FP_FUNCTION_MODULE_NAME FM. Resulting Adobe Form function module name should follow /1BCDWB/SM0000XXX pattern.
Open this FM in SE37 and go to function group code (GoTo->Main program). There you will find something like this and there get the name of main INCLUDE, which holds the code.
Then by forward navigation go to INCLUDE code and by simple Find of %textkey-name pattern you can observe all text elements which were utilized in the form.

how to handle file upload by a button in robot framework

when testing the webUI, when uploading a file through button,but when use input element, but it is ugly, If you have some ideas not replace button to handle uploading file.
Selenium 2 library provides "Choose File" keyword to upload the file. It takes two arguments, first is locator for the button and second is path to the file which needs to be uploaded.
Example: choose file xpath=.//div/input ${TEMPDIR}${/}file_pa.csv
Reference: http://robotframework.org/Selenium2Library/Selenium2Library.html#Choose%20File
I had the same issue and I was able to solve it using other libraries. Selenium2Library support "Input" field, so it only works when you have an input field to select the field then click other button to make the upload. Which is an old fashioned scenario. In order to achieve this you need other libraries that control the windows control like AutoItLibrary or SikuliLibrary Below is a quick example using either ways
AutoItLibrary:
sleep 2s
Send ${ImagePath} # This sends the file path to the entery field where the cursor is focused
sleep 3s
Control Click strTitle=Open, strText=Open, strControl=1, strButton=Button1, nNumClicks=1, nX=1228, nY=291
# In some cases some parameters cannot be identified easily so yo might just use only the buttong name as the following
# Control Click ${EMPTY} ${EMPTY} Button1 ${EMPTY} 1
For SikuliLibrary you can use the Press key to click the controllers and you can find many ways to emulate the copy paste either using javascripts or other key words. For the enter emulation on SikuliLibrary use the following:
Press Special Key ENTER #Case senstive (to press enter with Sikuli)

How to enter values to a text field using monkeyrunner

I am trying to enter some text to a text field in my android application using Monkeyrunner.
I wrote the code like this:
device.press('KEYCODE_BUTTON_SELECT',MonkeyDevice.DOWN_AND_UP)
device.press('KEYCODE_U','DOWN_AND_UP')
device.press('KEYCODE_S','DOWN_AND_UP')
device.press('KEYCODE_E','DOWN_AND_UP')
device.press('KEYCODE_R','DOWN_AND_UP')
while running the first line,the text field is getting selected.But The string "user" is not typing there.But the same code i can run out of my application ,In the android native search field i can enter "user" string using this code. I tried the same with device.type('USER') command also.That is also not working
If i am using this code
device.press ('KEYCODE_DPAD_CENTER', MonkeyDevice.DOWN_AND_UP)
It is taping one center button. (In my application page one button is there in the middle of the page.)
Try the following code. It's working in my case:
device.touch(x, y, MonkeyDevice.DOWN_AND_UP)
MonkeyRunner.sleep(1)
device.type('USER')
In the command touch put the coordinates of your edittext instead of x and y
One of the challenges would be to find the coordinates to touch, mainly using different screen sizes and configurations.
AndroidViewClient can help in this respect and you can avoid having to provide the coordinates for the Views and you can simply do:
subject = vc.findViewByIdOrRaise('id/subject')
subject.touch()
subject.type('AVCSample')
this lines were taken from one of the AVC examples: email-send.py
Do you have space character as part of the text you're trying to enter? Try without space and see if that works. Then, you can figure out how to deal with space.

How do I set alternate keys for a given command?

Preferences is bound to command+, by default. Suppose I want to add an additional key binding so that F2 (for example) also binds to Preferences? It must be possible because a few of the standard commands have alternate keystrokes.
According to the docs this is possible, but only with text commands.
"To add a sequence to an existing one, click the Add (+) button and type the new sequence. This only works for text commands; you cannot assign more than one sequence to a menu command."
You can find that in "Xcode 4.2 Developer Lbrary / Tools & Languages / IDEs / Key Bindings Preferences Help / Customizing Keyboard Shortcuts"

Resources