Accessing the find box from a chrome extension [duplicate] - google-chrome-extension

This question already has an answer here:
chrome extension: how to bind/hook to the browser's "search invoked" event?
(1 answer)
Closed 5 years ago.
Is there a way to access the find box from a chrome extension? I want to manipulate the text in the find box when the user hits ctrl+f

There is no way to directly access the Find Dialog when it is called/invoked. These are based on the solutions on the related question - Chrome Extension: How can I show the find bar and supply text for it? and chrome extension: how to bind/hook to the browser's “search invoked” event?
However, the workaround for this is use the Command API or window.find().
Command API
You can try chrome.commands, use the commands API to add keyboard shortcuts that trigger actions in your extension, for example, an action to open the browser action or send a command to the extension.
Hope this helps.

Related

Chrome Extension Newbie Question - check web page for entries, click hyperlink and refresh

I am just starting out writing my first Chrome plugin so hopefully I ask this question using the right vocabulary. Also looked for other questions that might be the same as this one and didn't find any that covered what I was looking for.
I've read the documentation on creating a Chrome Extension and have done the "Hello World" extension and see it write its output to the background console log. However, I'm not sure exactly how I would structure the extension I want to build between background and content. Any help/pointers (and examples) would be greatly appreciated.
Here's what I'd like the extension to accomplish:
Have it appear in the toolbar where other extensions appear
Have it be able to be enabled/disabled
When enabled:
Read data from the current page
If it finds certain entries "click" on the hyperlink to select them
Sleep for 5 seconds
Repeat the process
Or if there is another extension that does something similar already if you can point me to it maybe I can base my code off the same structure

Open and close windows [duplicate]

This question already has an answer here:
Showing and hiding multiple windows in PyQt5
(1 answer)
Closed 2 years ago.
I'm trying to create a simple app which consist of two windows. The first one is a Login Page and the second is a Registration page. The dynamics are as follows:
The first window is the Login window with two buttons; Login Button and Register Button.
If the login button is clicked, it starts a session if the credentials are correct.
Clicking the second button should close this window and open a new registration window.
The registration window has two buttons as well, the first simply confirm the registration, the second is to cancel the registration.
This cancel button is supposed to close the current window and open the Login window.
Steps 1 through 4 work perfectly, but in step 5 it keeps does not close the current window and simply opens a new Login windows.
Please write a basic code as an example of how to close the window using PyQT5. I don't want you to write all code but just a generic one. I just want to have an idea how it works and use it in my own code.
One way to approach this problem will be to implement a separate controller class. This class will control all the windows you want to show or hide.
This link will take you to a similar question which has the code you want.
GitHub link to code
Source: stackoverflow

no history when chrome reopen closed tab with extension

I'm using crxMouse and one of it's function is reopen closed tab.
Then I noticed that the opened tabs don't have history.
So, is there any chance for the same result as original one with chrome extension?
I can't find any related description in chrome's tab API docs.
thanks <3
https://developer.chrome.com/extensions/sessions
I modified the source code of crxMouse myself which could raise legal problems
in ./js/messaging.js you can find a function named G_reclosedtab() and replace its content with
chrome.sessions.restore()
and modify the manifest.json add 'sessions' into 'permissions' array

Open Chrome Command line without 1st run new tabs

I am using a command line script to open a particular web page in Chrome and send keypresses to that web page
When Google Chrome opens for the 1st time chrome opens up its own Tab e.g. welcome to chrome/login to chrome and this throws everything off.
I dont want any new tabs generated I want only the web page I asked for
Is there a command line switch or method to force chrome to not generate its own tabs. Perhaps registry entry etc?
I have tried some but no success so far
Thanks
Confuseis
Since your question contains the AutoIt tag, I have to assume you want an AutoIt solution.
The best way to do this would be to use chromes --new-window command line switch. This opens a new instance of Chrome, with a single tab pointing to the URL provided, by executing the chrome executable via ShellExecute.
$sPath = #HomeDrive & "\Program Files (x86)\Google\Chrome\Application"
ShellExecute($sPath & '\chrome.exe', '--new-window "https://www.google.com/"', $sPath, "", #SW_MINIMIZE)

How to get selected text in Chrome

window.getSelection().toString() doesn't get selected text in Chrome.
How can I do that?
Remember, that should be done within a content script, I explained how its done here:
Chrome Extension: how to capture selected text and send to a web service

Resources