Call "Select an element" from a sidebar button - google-chrome-extension

I am developing a Google Chrome Extension for UI Web Testing. And I need to call the native Chrome selector of elements, which You can invoke by CtrlShiftC or via the toolbar:
But I want to call it after click on my button which located in the elements sidebar:
How can I do that from a javascript click event of a button?

There's no way to invoke the built-in element selector from within the extension. Well, except the weird method of writing a separately installable native OS application that communicates with your extension via nativeMessaging API and sends a click event to the toolbar or triggers the hotkey.
A workable solution though is to use a 3rd-party JavaScript library that imitates the element selector behavior and once the element is selected you can highlight it in the Elements panel.

Related

Add things to the application menu in a Chrome app

Is it possible to add items to the application window (as opposed to the context menu) in a Chrome app? (Or, for that matter, alter it in any way?)
No. This menu is not part of the Chrome App execution environment. On some platforms (e.g., Chrome OS) it doesn't even exist. Where you see it, it's because the app wrapper for that particular OS supplies it automatically. Instead, use context menus, buttons and other controls, or, if you like, your own menu bar.

Issue in selecting 'Add' / 'Cancel' through Selenium Webdriver on Chrome extension dialog

I was trying to automate the process of adding Chrome extension through Selenium Webdriver. There comes a dialog that asks user to click 'Add' to add extension. I am facing issue in this part.
Here are the things that I've tried but did not work :
Trying to treat it as 'Alert' and accepting it.
Trying to get its properties but as it is not part of web page we can not see its properties. its chrome's in-build dialog.
Keyboard simulator (hitting Enter)
I know we can use AutoIt but don't want to integrate it with framework just for single issue. Is there any other way you folks can suggest. One workaround that I an thinking if we can get a global keyboard shortcut to select 'Add' on the chrome extension dialog.

How to insert menu-item into YouTube context-item

I need to know how i can insert menu-item into YouTube context-item using Google chrome extension.
I searched for that a lot and i found similar question but no any persuasive answer.
I need the solution very much.
The chrome extension API includes a Context Menu feature, but since the YouTube player uses Flash, there is a completely separate context menu that Chrome does not have direct control over.
So it is not possible to customize the context menu with the Chrome API. However, you may be able to get by with a (somewhat hacky) solution, such as covering the video with a transparent HTML DOM element. The DOM element should trigger Chrome's context menu instead of the Flash context menu.

Chrome Extension: Replace context menu item action

is it possible to replace the action of an existing item in the context menu in Chrome. Simple example, every time I press "Inspect Element", it opens another developer tool extension instead of the default.
It is not: at the moment, devtools APIs only function if the web inspector is open. There's no mechanism to open the web inspector for a user, it has to be her explicit choice.
That said, it sounds reasonable to give an extension the ability to hook into an element's context menu. That might be a good idea for an extension to the existing devtools or Context Menu APIs. Would you mind filing a request at http://new.crbug.com/? I'll make sure it lands in the correct queue.

Modal Dialog in Google Chrome Extension

I need a truly modal dialog to run in Google Chrome in Windows using extension, where the dialog doesn't allow users to click on other tabs etc. The search results so far seem to suggest that showModalDialog() doesn't give a true modal dialog, and the jQuery examples (like SimpleModal) don't seem to be able to stop users from accessing the other tabs or the other parts of the browser.
Alerts seem to be be working, so I was wondering if there is any other solution to this problem? Or do I really need to write a modal dialog from scratch using Javascript?
Using the hidden div methods in the web pages is not an option because I can't modify them.
You can simply use the native javascript function confirm
But I don't like when I can't do what I want without good reasons.
Furthermore, the user will can always switch to another Chrome window.
No sort of in tab HTML modal dialog will prevent a user from switching tabs. Even alert will allow users to switch tabs. You may be able to achieve this through a NPAPI plugin though.

Resources