typing menu key or application key in selenium - python-3.x

I'm trying to pass the menu key or application key ( https://en.wikipedia.org/wiki/Menu_key ) in Selenium, and due to some policy restrictions, I am not able to use the right click action to open the the dropdown menu. (IE: action.ContextClick(element) does not work).
There is not an option I see for the menu button in Keys.___, nor was I able to find an alternative after searching. Does anyone know how to access this menu without actually right clicking?

I had this problem before, and the menu key functionality is not supported yet in selenium.
What you can do however is in the language of you shoice, the equivalent of
driver.SendKeys(Keys.Shift + Keys.F10); (Shift + F10 is an equivalent to the menu key), and then follow the instructions here for navigating menus using actions and mouse position movements.

Related

Enabling keyboard shortcuts to confirm Dialogs in AppleScript

I am looking for a way to allow a user to complete a Dialog entry using keyboard shortcuts. Is this possible?
Other questions have discussed assigning shortcuts to the options in an AppleScript dialog box, but not to the "Continue"/"Okay" etc. button.
The main difficulty is that I'm using a multi-line text entry form, so the Enter button simply creates a new line, instead of targeting the default button as it would conventionally. I'm hoping cmdenter can be assigned to the default button instead.
The line of script defining the dialog in question is:
set theResponse to display dialog "Enter tasks:" default answer "
" buttons {"Cancel", "Continue"} default button "Continue"
Running your AppleScript code from Script Editor on a US English MacBook Pro, whether or not something is typed in, fnenter presses the Continue button.
The same keyboard shortcut works on an US English Apple Magic Keyboard when connected to the MacBook Pro and I'd assume any US English Mac it was connected to would do the same. I only have the MacBook Pro to test with at the moment.
In macOS, by default, pressing the tab key in this use case will not move between the controls as the controlling setting in System Preferences > Keyboard > Shortcuts is not set to allow it to act on all controls.
You must select one of the following options, depending on the version of macOS one is running, in order to use the tab key on all controls.
If you see:
Full Keyboard Access: In windows and dialogs, press Tab to move keyboard focus between:
(•) Text boxed and lists only
( ) All Controls
Select: (•) All Controls
If you see:
[] Use keyboard navigation to move between controls
Press the Tab key to move focus forward and Shift Tab to move focus backward.
Check: [√] Use keyboard navigation to move between controls
With this done, one can then use tabtabenter to press the continue button, with the dialog box produced by the code shown in the OP.
Side Note: One can also try fncommandenter as that was necessary from within a VMware macOS Catalina virtual machine that I also tested in.
⌘-Enter (on the numeric keypad) presses Continue
If you are in a multiline text field, hit the Tab key so that focus is on some element other than the text field. Then the Enter key should route properly to the dialog's default close button.

How can I change project view on eclipse to hierarchical only using Linux terminal command?

How can I change project view on eclipse from flat to hierarchical only using Linux terminal command without right click on the menu?
Although there is no command line option for this, it is possible to switch the presention between flat and hierarchical using only the keyboard, if you are already in the Project Explorer view.
Press Ctrl+F10 to display the view menu. Use the arrow keys to highlight the menu item you want (in this case, the Presentation menu item is the first, so just one press on the down arrow), then use the right arrow to show the sub-menu for that item. From there, you can either use the hot key (underlined in the submenu, so "f" for "Flat, "h" for "Hierarchical) or use the up and down arrow keys, then hit Enter when on the item you want.

System wide right click context hook

**Hello..
i am creating English To Gujarati Dictionary WinForm Application.
I need to set a system wide hook to the right click context menu on for text selection.
it means when this application is running,and if user selects word from any program and right click on it gujarati meaning of that word should be displayed as menu item.
How to do this?
or any other options like Registery Programming,shell extentions etc...?
i have to do this,even if you say its not possible.
so please help me.**
Hooking the mouse activity is the easy part. See SetWindowsHookEx, and lots of questions regarding hooking in SO. This way, you can tell when the mouse is right-clicked.
Getting the selected text is the harder part. See WindowFromPoint, for starters. You'd have to recognize the control, and if appropriate get the selected text from it. This will not always be possible using simple Win32 functions, if the control is complex.
Adding the translation to the right-click menu is probably the impossible part. Adding stuff to explorer context menu is not a problem, because explorer provides that possibility. But various applications will have various right-click menus, without a way to extend them. They might not even use Win32 for the menus, for whatever reason. A better option, IMO, would be one of the following:
Forget about changing the right-click menu. Open a window next to the point of selection with whatever content you want, and let the application show its own right-click menu.
If the user right-clicks while, say, pressing shift, show your own right-click menu, and don't pass the message to the application. So the user will see only one menu, which is yours. The user must of course be aware of this combination.

How to add custimized context menu item on right click in browser window?

Here I want to add my custom menu option i.e. ColorZilla, Aptana Studio on web browser right click
You can only do this with a browser plugin. Each browser will have its own syntax for plugins and specifically adding context menu items.
Aleks G. is right you cannot do that directly within the browser.
I don't know if it can help you or if it is what you are looking for but, within the browser you can handle the right click interaction in order to display your own custom menu ( not a particular menu item but the full menu ) ... meaning the default browser menu won't get displayed at all.
In case you are interested, you can have a small sample here

What is the difference between a keyboard accelerator and a shortcut key?

What is the difference between a keyboard accelerator and a shortcut key?
John - I don't believe that is correct.
MSDN defines menus as having:
'Menu access keys' - the underlined letters in the menu item name.
'Menu shortcut keys' - the key combination to the right of the menu item.
It is menu shortcut keys (text to the right of the menu) that are identified as synonymous with keyboard accelerators, not menu access keys - see paragraph on Menu Shortcut Keys in the 'about menus' MSDN page - it is this section directs towards information on Keyboard accelerators, not the section on Menu Access Keys.
As far as I am concerned a keyboard accelerator is a 'shortcut key'. They may be used regardless of the visibility of a menu, and are only included in the menu as a reference for the user and a way for the user to pick up on shortcuts for menu items that they may regularly use. Hence they may be defined without being displayed in the menu at all.
See MSDN page on Keyboard Accelerators:
Typically, users rely on an
application's menus to learn the
command set and then switch over to
using accelerators as they become more
proficient with the application.
http://msdn.microsoft.com/en-us/library/ms646335(v=VS.85).aspx
Although accelerators typically
generate commands that exist as menu
items, they can also generate commands
that have no equivalent menu items.
http://msdn.microsoft.com/en-us/library/ms646335(v=VS.85).aspx
For Windows, a keyboard accelerator is represented by an underlined letter on a button, menu or other label:
keyboard accelerator http://content.screencast.com/users/TreefortJohn/folders/Jing/media/70d5002f-5832-448a-9379-256b7a8c4fd7/2009-01-12_2304.png
On recent versions of Windows, they are hidden until you press the Alt key. Then you can hit that letter to select the menu, button or other input control.
A shortcut key typically does not have a visual representation, except for when they're listed in menus. Ctrl-C, Ctrl-X, Ctrl-V are examples of common shortcut keys, which you can see listed next to their respective menu items.
About Keyboard Accelerators

Resources