I need to get the value of the Gmail's textarea (the textarea where one write the email body).
Since I need to perform some I/O ops on the value of the text area I need to text to be formatted correctly.
Since I noticed that the value of the textarea in gmail is oddly always undefined (see img below)..
.. I started to implement some internal utilities to get the right HTML node, transform it into a string and extract the text out of it. I thought I'd be able to reproduce the original text formatting by searching for <br> tags and
Unfortunately, it's much more nuanced than this, there are much more edge cases that are hardly predictable.
Does anybody know if this is actually a solvable problem and if so, how?
I don't know what you are trying to accomplish here but It seems like you need to change the content of a message and send it to using gmail message box and send the email
since you are using js you can try node js and try to scrape it using a web scraper
you will have to install node js and install "request" and "cheerio" dependencies and make a req to Gmail/compose mail and scrape that page and target the test area you want and append your message what ever you wan to do and internally post it
Related
I am building an extension in Thunderbird with UI element message_display_action for my school project. I am wondering if I can access full email source code from java script file that I am using for building up my html page when pressing on button my extension. I found a funciton named getFull(messageId) in documentation at https://webextension-api.thunderbird.net/ but I don't understand how to use that function and I don't even know what messageId is. I know it is a integer but I don't know how to get that integer for a specific email. I entered permission (messagesRead) in my manifest file of extension for reading emails but i still don't know how to use that function. I didn't find any examples or tutorials on the internet so if anyone can help me or atleast point me to the right direction.
Getting the id of the currently displayed message
You should take a look at https://github.com/thundernest/sample-extensions/tree/master/messageDisplay, which is an example how to get the id of the currently displayed message from the messageDisplayAction using messageDisplay.getDisplayedMessage().
See also https://webextension-api.thunderbird.net/en/latest/messageDisplay.html.
messages.getFull()
Didn't find a small example using that API. As a hint you should note that this function works on the different MIME parts a mail consists of.
You will not get the complete source of the email that way. To get the raw source you would need to use messages.getRaw(). But you should probably not use getRaw() unless you really need it, because you would need to handle the complete parsing of the message yourself.
Solution: I used PYTHON and retrieved the text using SELENIUM, since I had to login and it was easier using automated chrome. Thanks!
I've a web URL which returns a plain text.
The URL Looks like this:
http://xxx.xx.xxx.x/cgi-bin/p05_equip_sample.cgi?_equipId=7&_op_type=1
and it returns a plain text like this one:
'' 4017,机房UPS,ENP_UPS_NXC304060K[COM]^2,Input Voltage of Phase A,240.500000,V,1581995093,0,1,1,2,2;3,Input Voltage of Phase B,234.100006,V,1581995093,0,1,1,2,2;4,''
which are values from different sensors that I want to include into a JS Heatmap plugin.
What I need to do is include all that text into a var so I can extract the characters that I need (I know it's not the best solution, but text position never changes, only values).
I tried to use Jquery with GET but I think I'm missing something and with other methods I get a CORS warning. I need to do it on client side so no NODE.JS or PHP I guess.
Thanks!!!
Apologies if that's the wrong place, but have no clue where to ask.
We are building Firefox addon that works on selected websites. Now, because those websites tend to change once in a while, I want to run once a day a javascript script that will check whether the specific part of code has been changed, and if it did, we would get some return message (ideally directly to my email).
What would be the easiest, simplest way to do that? I've read about webcrawlers, webscrapers, but they seem to be doing far more than we need. We basically want to run from our PCs connected to internet a small script that will do that simple check and send us email as soon as the change to the specific part of html body has been detected (or to be more specific - selected elements have not been found).
Any help greatly appreciated
Basically you might set up Google Spreadsheet to scrape pages' parts thru IMPORTXML function (here with an example) using xpath. Then you set up notifications in a spreadsheet: Tools -> Notification Rules
Now each time the scraping function (IMPORTXML) gets content that is different to previous one, spreadsheet should trigger a mail to you.
As an off-the-shelf alternative I also might recommend some tools that track pages' and/or their parts'(!) changes including notifying by email.
I'm trying to retrieve some information from Gmail but have been unsuccessful after many attempts. This is the line of code that I'm trying to extract using javascript.
Inbox (182)
Im trying to get the text "Inbox (182)," to do that, I'm using this piece of code
NSString *js_result = [webview1 stringByEvaluatingJavaScriptFromString:#"document.getElementsByClassName('J-Ke n0').innerText"];
This however does not work, my result being nothing at all, and I've tried many alternatives but none have worked. All I need to do here is extract the "Inbox (182)" text in any way possible. Thanks.
I think your javascript is incorrect, since there are multiple elements with that class. If I login to gmail, this works:
document.getElementsByClassName('J-Ke n0')[0].innerText
I would be weary of using this in a production environment, though. It seems very brittle; that class or order of elements could be changed by Google at any time.
You also need to make sure that the page has loaded before trying to execute javascript. Typically this is implemented in a webViewDidFinishLoad: callback. If you're not getting a result and your JS is valid, this is probably the issue.
This morning I woke up to a JavaScript alert on a project of mine that runs KnockoutJS, jQuery, and Underscore.js. It says "I can run any JavaScript of my choice on your users' browsers". The only third-party JavaScript I am downloading is Typekit, and removing that does not make this go away. I've searched my JavaScript and vendor JavaScript and this string does not come back up matching anything.
How would you troubleshoot this and/or is this something that is known to occur?
If you have a database for your application, that would be the next place to check. I'm guessing somebody found and exploited an Injection vulnerability (either un-sanitized HTML input or SQL) and injected the script into a page via the database.
The last place would be to look at the ruby code to see if somehow a malicious user modified your source.
You obviously take an input from user and then outputting it back as part of HTML without quoting or sanitizing. There's two quick checks to do:
1) Open source of page that outputs this alert and search inside source for exact text of alert - this should give you clear indication of what user-filled field is compromised.
2) To be sure, search all other fields in your database generated by users (login names, text of comments, etc.) for words "script" and "alert".
For future: always sanitize your input (remove HTML tags) before inserting it in HTML page OR escape symbols as entities according to standards OR explicitly treat is a plain text by assigning it to value of text node in DOM.
It sounds like a hack attempt on your site. Check any databases, text files, etc. that are being used that are receiving user input. It sounds like you're not checking what's being posted to your server I'm guessing.