send images on whatsapp web with javascript DOM - google-chrome-extension

How do I send images on whatsapp web, through javascript, I already have the script that sends the message, but I would like to increase this image function

Correct me if I am wrong you want to trigger send button via dom.
Short answer is you will have to get the button first then hit click like this:-
document.querySelector('button[aria-label="Send"]').click()
screenshot:- https://prnt.sc/LdKzLkVkM5YY

Related

Using clickable links in DialogFlow

Is possible to use hyperlinks in the middle of some text with DialogFLow?
Currently the best I can get is to use DialogFlow Messenger with an extra response of type Custom Payload and add there a richContent response of type "info" with the link.
But I want to add the link as a normal "< a href >" element, is that possible somehow?
Did you already try to send raw URL in your message?
It will automatically turn the URL into a link in almost all chat application.
I already try in Telegram, Facebook Messenger, Line Messenger, etc.

Is it possible to put links in chrome desktop notifications

I'm making a chrome extension which displays desktop notifications on particular events. I am receiving and displaying the desktop notifications just fine, but the problem comes when I try to put attribute tags into notification. Instead of being the text as tags to be appended to the notififcation's DOM, Chrome seems to just interpret them as plaintext, resulting in the content of the notification being just html source code.
Is there any way that I can have the body of my messages be appended as HTML instead of just text or am I just out of luck?
It used to be possible, but now it's not. But you could use a "Rich Notification" and put the link on a button. See https://stackoverflow.com/a/13328513/488287 for details.

Calling chrome.browserAction.setIcon from content script the way it is done in background script

I am making an extension for chrome. It fetches data from webpages and emails it via local email client. I have a toolbar button which user has to click to invoke the script.
My script works for a few selected urls. I want my toolbar button to change icon based on whether the url is among our list or not. For example for site1 it should be redicon.png and for site2 it should be blueicon.png. I can change button icon using chrome.browserAction.setIcon. But the problem is that this API does not work in content script. It works fine in the background.js file but not in content.js. Kindly tell me how to achieve this.
I know using pageAction instead would do the trick but my client requirement is that the toolbar icon should change rather than appear and disappear.
What you need to read about is message passing. You are right, content scripts have limited chrome API. However, you can contact background page from content script and tell it to execute anything from chrome API for you. First, you need to create a listener on a background page that will be waiting for messages and then send a message from a content script.

click of a submit button on any website using Google extension

On the click of a submit button on any website eg. Amazon, I want a .html to be triggered using google extension. please let me know if it is possible.
You can indeed execute scripts on (almost) any page using content scripts that can manipulate the DOM, allowing you to add an onsubmit event listener to a form (more reliable than onclick on a button as it is fired however the form is submitted - e.g. hitting ENTER).
What exactly do you mean you "want a .html to be triggered"? Triggered in what way? If you want to open another tab when this happens, you can do this using message passing to tell your background page to do this for you using the chrome.tab.create API method.

Google Chrome extension modifying page request

Is it possible to catch the request of a page before it is sent out? I would like to check and modify the data sent out. For example if I have a text box on a page and the form was submitted I would like to get to the data of the text box using the extension modify it and then send it on it's way.
If any one can point me in the right direction that would be grate
Chrome has chrome.experimental.webRequest API module which allows to catch web requests before they are sent, but from the docs it doesn't look like you can modify them, just observe.
I think you would be better off injecting a content script to pages and listening to onbeforesubmit event on forms.

Resources