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

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.

Related

Adding buttons on the GMAIL Toolbar

I currently have a chrome extension which adds a new button on the GMail Toolbar each time I open a message in GMail on a chrome tab. This is done currently using inboxSDK's (1) registerThreadViewHandler() and (2) registerMessageViewHandler()
Unfortunately, using inboxSDK library will make the extension call remote code which is disallowed in Manifest V3.
I would like to ask if there are other possible and sustainable ways to do this without inboxSDK.
Thank you very much.

Handling file download popup of chromium browsers using VBA

I'm using Selenium with VBA and Microsoft Edge to collect information, and download some files from a webpage. Everything works great except for the downloading part.
On this example site: https://file-examples.com/index.php/sample-documents-download/sample-doc-download/, Code like
oWebDriver.FindElementByXPath("//a[#href=""https://file-examples-com.github.io/uploads/2017/02/file-sample_100kB.doc""]").Click
will result in a popup like this:
Unfortunately, it is not possible to simply change the browser's preferences in my case, because the macro will be running on a machine with limited authorization and the following setting can not be changed:
The last option can be translated to: "Ask for the storage location with every download" and it is locked.
It seems that the "Save As" popup in the first screenshot can't be accessed, neither with Selenium nor with SendKeys.
So the only option seems to be using the Windows API with VBA to somehow automate this step, however, even so, it seems to be impossible to get a handle on this pesky popup. I tried finding the window with Spy++ and it doesn't seem to show up as a separate window:
The only solution I can now think of is getting the window size of the parent Edge browser window, navigating the mouse to the approximate position of the "Save As" button, and clicking it there using VBA and the Windows API. Obviously, This is not a great solution, as it would be quite frail and can easily break with the smallest misalignment.
Is there any other way to automate this step that doesn't require moving the mouse and automating the "manual" clicking, using only VBA with Selenium?
Selenium only works for browser web page automation. The pop-up is not a part of the wab page so Selenium will not be able to recognize it.
And I think any setting in Selenium including "download.prompt_for_download" won't have effect. The pop-up is controlled by the browser setting, and the browser setting is controlled by your group policy, you can't override it with Selenium settings.
I think the only way is to use some 3rd party UI automation library to click that option along with Selenium, just like what you said in the question.

Opening a Chrome extension as a pop-up using a link

I have a chrome extension installed in my browser. When I click the extension's icon in the menu bar the extension opens as a floating pop-up, as expected.
What I am trying to do is to open the extension in Chrome via a link/shortcut/whatever from another program. As a first step I've tried opening the extension from the command line, ex:
chrome "chrome-extension://abcdefghijklmnopqrstuvwxyz/index.html"
This works but the extension opens as a new tab and takes up a full broswer page instead of a just being a pop-up. Is there a way to open the extension as a pop-up on top of any open tabs?
Sadly, it's completely impossible.
There is an API in the works, but it would require at a minimum a user gesture, at a maximum explicit invocation of the extension.
So opening a link would not be enough, nor would a Native Message be.
you cant make the native extension popup to show programatically but you could use a content script that displays the popup (using the new for example) on the tab that you want.

Chrome extension: Multiple tabs in popup window

I was wondering if there is a way to divide the popup window into more than one tab, when each tab functions as a different web page, using chrome extension APIs. Does somebody know if that's possible?
If I can't do that, I thought I will give up the division into separate web pages and just use tabs on the same web page, like UI tabs for example.
Can you suggest a third way?
Browser\Page Action Windows are Windows of type Popup, you cannot add further tabs to the popup window.
As pointed out using some sort of UI Tabs will solve your problem. Let me know if you need more information.

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