Follow up - Google Script to Fill out HTML Form - html

I tried commenting on the response by Rob in the original post:
Google Script to Fill out HTML Form
But I am shy of 11 points to do so, hence asking my own question here.
I have a similar web form automation requirement and I like Rob's response on using
UrlFetchApp.fetch(url, options)
I like this approach as it is clean, and can wait for response from server. This helps in batch processing multiple forms. There is no fiddling around with DOM elements or adding delays that may fail due to runtime issues like sudden drop in internet speed.
My question however is, how do I create session if the website requires me to login? I did lookup documentation but couldn't find session options:
https://developers.google.com/apps-script/reference/url-fetch/url-fetch-app
I am open to suggestions if I can write my own program in VSCode using Node.js, JQuery, javascript etc, that loads json file as data and something that I can post on GitHub/GitLab for others to use as well. I know VBA method of doing it, but it relies on DOM elements to mimic user interaction. There is another program mini mouse macro that has a great reputation, but its an exe and mimics user interaction of clicks and delays. I want to see code that I am running.

Related

How to find parameters (variables) in a web site by using google chrome for JMeter

I just started to use JMeter. I want to know how can I see the variables at google chrome. I tried so many ways and I watched lots of videos but there are no answers. Every video says that; you can find it in the network page from console. But on the website which im looking for variables, I just can see JavaScript code token. There is no token as variable. Is there a way to import it into JMeter or is there other way to find variables in google chrome. To put it in a nutshell, I'm working on a project. I want to load test for a website but I got problems with POST request. I cannot login the threads because of cannot find the variables. I need help !! :(
This is what I am trying to reach with screenShot...
This is my chrome's screenShot
I'm just tryna get the parameters like first pic.
There are 2 possibilities:
The "variable" comes in the response, take a closer look at:
response URL as it may be a part of the URL after redirection
response headers (can be observed in the "Network" tab of the developer tools)
response body, you can view page source
The variable gets "calculated" in the browser using JavaScript code. If this is the case you should find the relevant JavaScript function and implement it using JMeter's JSR223 Test Elements
You can also try recording your test scenario using BlazeMeter Proxy Recorder, it's capable of exporting recorded scripts in "SmartJMX" mode with automatic detection and correlation of the dynamic parameters. In case #2 it will not help, but if the variable comes with the response most probably it will be able to detect it. More information: How to Cut Your JMeter Scripting Time by 80%

How can I create a program or bookmarklet that can scrape facebook-chat messages for spam links?

There is a Facebook app which has enabled the depricated facebook-chat feature where users can chat whilst playing their game. Unfortunately there has been a dirge of spammers and scammers posting in this chatroom, which we would wish to automatically detect and send emails or some other alerts to us so that we can more immediately block/ban these users.
Is this possible somehow? What we've tried was to create a python scraping application but it wasn't immediately obvious how to log into facebook and get HTML of an app through a python call.
I've since been introduced to bookmarklets as a concept. Perhaps this could solve the issue? There could be some type of javascript code in a bookmarklet, and all one would need to do is load up the game, open the facebook-chat, and then click the bookmarklet, and leave the computer running 24-7. The javascript would parse the DOM for suspected scam links and send email reminders when found.
This is just me brainstorming possible ideas. I'm really not sure how to approach this automation problem, and I am not finding anything useful online either.

Prefill webpage from Lotus Notes client application

Looking to prefill a webpage (a form in a wordpress site) from a lotus notes application. My investigations to date show that using the query strings behind the urlname should work - however I am missing something here.
www.url.com/register?fname="bob"&sname="smith" etc...
I thought this could be done, but am not sure where the starting point would be?
Ideal solution - webservice from the owner of url.com to allow us to populate and get a response once done. They are not keen to do this as it does not save them any time, just our business.
I am looking to understand how to prepopulate the webpage so that the user just has to submit the form at url.com.
You could go mega-sneaky and use the Selenium WebDriver to launch a browser session on your client. It has full control over the browser and can sniff out the fields you need to populate. I wrote some simple code for starters - but the samples on the original web site might be more comprehensive.

Is there a way of seeing the script code for an action I have performed?

I am new to writing scripts in Google Apps. I am trying to script various actions in Google Docs which previously I would have done through the main user interface. Is there a way of "recording" such actions as they are carried out, analogous to recording a Macro in Excel?
For example, I am creating a Form in Google Docs. Using the main interface, I can add an Image item and upload an image from another source (Google Drive, my desktop, etc.), but I can't work out the script code that would perform this same action. Is there any way to output the script that would have carried out the same action that I have just performed?
Many thanks.
Currently, you cannot 'record' a macro.
There is an issue in the Issue tracker (issue 650) where Google have mentioned that it is not feasible at the moment (Jul 2010). You may star the issue to register your interest to the enhancement request.
I think the real issue is that the GApps scripting functions are manipulations of the underlying object model of the document. The UI also manipulates the underlying object model, but no one has yet created the functions to emulate the UI in GApps script form. Recording the actions would then be a separate step and converting the recorded actions into GApps functions would be yet another step.
So you need to be clear: is your goal to be able to record and play back UI actions, or is your goal to be able to upload an image into a GDoc? You asked about recording and that's the answer you got. Maybe if you asked about how to use GApps to add an image to a GDoc, you would get a more useful answer.
My own personal question would be:
I haven't figured out how to use the GApps documentation very
efficiently yet. I do a lot of fruitless hunting. How do I find in the
docs how to add an image to a GDoc?
I hope this helps.

Chrome Extension Development - need help getting started

I'd like to try my hand at some Chrome Extension Development. The most I have done with extensions is writing some small Greasemonkey scripts in the past.
I would like to use localStorage to store some data and then reveal the data on a extension button click later on. (Its seems like this would be done with a popup page)
How do I run a script everytime a page from lets say http://www.facebook.com/* is loaded?
How do I get access to the page? I think based off my localStorage requirement I would have to go down the background_page route (correct?) Can the background page and popup page communicate across the localStorage?
UPDATE:
I'm actually looking to learn the "Chrome way". I'm not really looking to run an existing Greasemonkey script
Google actually has some pretty good documentation on creating extensions. I recommend thoroughly reading the following two articles if you haven't already done so:
http://code.google.com/chrome/extensions/getstarted.html
http://code.google.com/chrome/extensions/overview.html
If you want to give your extension access when the user browses to Facebook, you'll need to declare that in the extension's manifest.
Unless you're wanting to save data beyond the life of the browser process, you probably don't need to use local storage. In-memory data can just be stored as part of the background page.
Content scripts (which run when you load a page) and background pages (which exist for the duration of the browser process) can communicate via message passing, which is described here:
http://code.google.com/chrome/extensions/messaging.html
Overall, I'd suggest spending some time browsing the Developer's Guide and becoming familiar with the concepts and examples.
Chrome has a feature to automatically convert greasemonkey scripts to extensions!