Click element, hold Shift key and click another element in robotframework - robotframework

I need to be able to click an element on a webpage and hold the Shift key on keyboard and press another element.
Can I implement this behaviour using "Press Key" in Selenium2Library?

You can try to achieve your scenario using AutoItLibrary
First you need to install win32com.client, use below command
pip install pypiwin32
Then use AutoItLibrary command like as per your requirement
Send | {SHIFTDOWN}
For more info visit here

Use using Pyautogui library. This library simulates the User Actions on GUI such as Mouse Control, Keyboards inputs,etc. You can find details at
https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjN1ZbrocrSAhWIFJQKHXbiBGcQFggbMAA&url=https%3A%2F%2Fpyautogui.readthedocs.io%2F&usg=AFQjCNEe5LY5eMdaquVD421_u-mpoFUOYQ&sig2=Lj-e4YldvbLNEvPe4NFHrA
Also U can install this library using pip by following keywords in following docs
http://pyautogui.readthedocs.io/en/latest/install.html

Related

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 catch user pressing escape key in Atom Package

I am developing an Atom package, and I have certain commands that get executed when I press Ctrl-Shift-Up.
The first time I press Ctrl-Shift-Up, Atom enters a "mode" where things happen differently. Now, I think I know how to do that part. But I don't know how to tell atom to hijack the Escape key.
You can assign a command to Esc through your package keymap.
Example:
'atom-text-editor:not([mini])':
'escape': 'my-package:do-stuff'
If your CtrlShift↑ shortcut creates a custom view, you would want to limit your shortcut to its CSS selector.
Example:
'.my-custom-view':
'escape': 'my-package:do-stuff'
Further reading:
Atom Flight Manual: Keymaps In-Depth
Atom API: KeymapManager

How to set user command in Qt Fakevim?

(1) For example, I want to set map gd g* in Qt's Fakevim like below but failed.
(2) And also I'd like to set F3 as the save command, how to do it?
(3) In Fakevim, it provides an option "Read .vimrc", but where to find the file .vimrc?
Thank you!
It doesn't look like there is a lot of documentation for FakeVim, so official sources might not exist. Most of this was obtained by experimentation.
If you want to dig deeper, I guess there's no source as official as the actual source: http://qt.gitorious.org/qt-creator/qt-creator/blobs/0809986e501415fe2c8508800b94b5b3169dc048/src/plugins/fakevim/fakevimplugin.cpp
User commands
First off, realize that in Tools>Options>FakeVim>User Command Mapping, you're only setting what your user actions will perform, not how you perform them.
By default, user command #1 is triggered by pressing Alt-V, then 1.
Alt-V, then 2, triggers user action #2, and so on.
You can change the keyboard shortcuts through the general QtCreator configuration interface, under Tools>Options>Environment>Keyboard. There is a "FakeVim" section with all the user actions listed. Select your user action of choice, press the little "erase" icon in the input field under "Shortcut", then press your desired shortcut key, which should appear in the input field.
Second, to finish a command where you would normally press enter, you should literally type in <CR> after the commands. You also need to enter in ':' to enter command mode.
So if you wanted to map the vim save command, ":w", to F3 via FakeVim, you would:
Go to Tools>Options>FakeVim>User Command Mapping.
Enter ":w<CR>" as one of the user commands (say #7).
Go to Tools>Options>Environment>Keyboard.
Find the FakeVim action "UserAction7".
Set F3 as a shortcut for it.
Now, every time you're in the editor, you should be able to click F3 and have the FakeVim :w command execute, which will save your file.
Note that there is also an option to set a shortcut for "Save" directly in the QtCreator keyboard settings, so for this particular shortcut you don't actually need to go through FakeVim.
Setting shortcuts for other vim commands should be similar. Note that you're restricted to the subset of vim commands that FakeVim implements. Refer to the source, linked above, for checking any particular command you're wondering about.
Vimrc file
On Linux this would be ~/.vimrc, a file in the user's home directory. I presume you're asking about Windows.
The best source I can find is this bug report about it being hard to use Fakevim's vimrc on Windows: https://bugreports.qt.io/browse/QTCREATORBUG-8748
Following that, the file Fakevim looks for is ".vimrc" in %USERPROFILE% (you can enter a name like that in Explorer to go to the folder). However, it's tricky to access a file with a name like that on Windows. (Thus why the real vim uses '_vimrc' on Windows -- but FakeVim apparently doesn't, at least at the moment.)
Here is a superuser page with workarounds for how to create such files on Windows: https://superuser.com/questions/64471/create-rename-a-file-folder-that-begins-with-a-dot-in-windows

vsx shortcut doesn't work

I'm now trying to add shortcut for my package. And I find this article which may be useful. As the article described, I add KeyBinding attribute in vsct file, like this:
<KeyBindings>
<KeyBinding guid="guidPackageTestCmdSet" id="commandId01" editor="guidVSStd97"
key1="M" mod1="Control" >
</KeyBinding>
when I run this package, you can see the shortcut info "Ctrl+M" at right of the command name, but it doesn't fires after I press control + M.
I am assuming you are creating for VS2010. Take a look at this page. Seems like Ctrl+M is a multiple binding. Once you press Ctrl+M check for the status bar in VS and you should be able to see it waiting for another command.

Creating new shortcut in notepad++

I am trying to add a shortcut or a button in notepad++ to call an external program on the file I am currently editing.
For example, let's say I have the program "analyzer.jar". I would like to create a button (or shortcut) in notepad++ that would directly run the command "cmd -K java -jar analyzer.jar "$(FULL_CURRENT_PATH)".
Since I haven't found any solution yet, any help would be deeply appreciated :).
Well, in fact I found how easy it is to create a shortcut for a command:
Go in the menu and select "Run &rightarrow; Run..." (or press f5)
Type your command
Click on "Save", and select the keyboard shortcut of your choice
Sometimes, when you look for complicated solutions, you don't see the simple ones...

Resources