Auto-Filling Web Form by an HTML/PHP/JS page - javascript

I have a very simple issue and I'm looking for a simple way to do that.
In fact, I'm searching to auto-fill a Web-Form from an official webPage of an institution and I would like to do it in Javascript into a webpage which will do it automatically on client-side.
I tried CasperJS/PhantomJS which is very useful to do that but they have to be run by command line and not by a js script.
This webForm is very simple.It has several dropdownList, checkboxes and text input with a simple submit button.
I don't need some detailed code but just the way/tools to achieve that. I'm on it since 2 weeks without any good results.

Ideally, this should be done server to server. What you want is a web service. This way you don't have to have a client machine with a browser sitting open to handle this.
A quicker and dirtier method would be to submit the form data directly to the 3rd party web server via cURL:
https://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-to-do-a-post-request
http://curl.haxx.se/docs/httpscripting.html

The best way to do that is using Selenium. Use Selenium and you can easily fill out forms of third party.

Related

Populate a form on another website from your own site

I am trying to build a webform that will copy all of the form fields to another, external website. I am making a separate sign up form for USA Judo (https://webpoint.usjudo.org/wp/Memberships/Join.wp) but I need to send the formfield data from my version of the form to the original website. I do not have control over the original website.
Any ideas? I'm completely lost here.
Thanks.
-Scott
The long and short answer is, unfortunately you can't.
Without having control over the original website, there is no way to pre-populate forms remotely.
The website you have stated also has a multi step signup form, which would make automatically filling it in not straight forward.
Cross Site Request Forgery is adopted in most modern browsers to stop sending forms to remote websites unless setup specifically todo so.

How do I implement ReCaptcha in a Single Page Application (SPA)

I have a Single Page Application (SPA) I would like to add ReCaptcha to.
This application is hosted using IIS as flat Html, Css & Javascript, this SPA in turn talks to a separate REST server (using CORS) for all dynamic content.
The REST server is written using ASP.net WebAPI. The problem is; all examples I have seen of ReCaptcha all use ASP.net MVC (or other languages) to inject html into the webpage, I cannot modify the webpage using ASP.net in this manor. Hopefully someone else has had the same problem.
I am really looking for some 2 parts, first the HTML that belongs on the client, and secondly the Controller that would be on the REST Server to verify with google. Even if this is in another language that I can convert, this will be useful!
Looks like what I wanted was simply to use reCaptcha without plugins (https://developers.google.com/recaptcha/docs/display)
I have used ngx-captcha with my angular project.
Here's how I kept my submit button disabled until recaptcha checkbox is checked.
//code
<ngx-recaptcha2 (success)="handleSuccess($event)" #captchaElem [siteKey]="siteKey" formControlName="recaptcha">
</ngx-recaptcha2>
once captcha is filled , it emits a success event , so use it in a method to make a variable true/false based on which you can enable/disable submit button

Making a database application with just JavaScript?

I need to make a dead simple web application. Users hit a static HTML page and enter some basic info (name, and comment). When they hit submit, I want to store this info in either a CSV file or a sqlite on the hosting server. I know all of this is possible with django/python or ror/ruby but is there anyway to do this with just JavaScript?
Thanks in advance..
There's few ways to handle this, using just javascript. Which is to use a hosted Backend-as-a-Service.
You would need to make API calls on the client end, and will be able to connect to it without having to rely on a backend technology.
Most of these technologies are built for mobile, but you can still use it to build it on your static HTML pages. (cross browser issues may vary).
Here are some:
Firebase (https://www.firebase.com/docs/web-quickstart.html)
Parse (https://parse.com/docs/js_guide)
There's more out there if you google Backend as a service.
If you are looking for something more simple, just need to take information and store it (like a form), then I would suggest looking at these services:
Wufoo (http://www.wufoo.com/)
jotform (http://www.jotform.com/)
Hope it helps!

Python - Transferring session between two browsers

The issue:
I have written a ton of code (to automate some pretty laborious tasks online), and have used the mechanize library for Python to handle network requests. It is working very well, except now I have encountered a page which I need javascript functionality... mechanize does not handle javascript.
Proposed Solution:
I am using PyQt to write the GUI for this app, and it comes packaged with QtWebKit, which DOES handle javascript. I want to use QtWebKit to evaluate the javascript on the page that I am stuck on, and the easiest way of doing this would be to transfer my web session from mechanize over to QtWebKit.
I DO NOT want to use PhantomJS, Selenium, or QtWebKit for the entirety of my web requests; I 100% want to keep mechanize for this purpose. I'm wondering how I might be able to transfer my logged in session from mechanize to QtWebKit.
Would this work?
Transfer all cookies from mechanize to QtWebView
Transfer the values of all state variables (like _VIEWSTATE, etc.) from mechanize to QWebView (the page is an ASP.net page...)
Change the User-Agent header of QWebView to be identical to mechanize...
I don't really see how I could make the two "browsers" appear more identical to the server... would this work? Thanks!
Since nobody answered, I will post my work-around.
Basically, wanted to "transfer" my session from Mechanize (the python module) to the QtWebKits QWebView (PyQt4 module) because the vast majority of my project was automated headless, but I had encountered a road block where I had no choice but to have the user manually enter data into a possible resulting page (as the form was different each time depending on circumstances).
Instead of transferring sessions, I met this requirement by utilizing QWebViews javascript functionality. My method went like this:
Load page in Mechanize, and save the downloaded HTML to a local temporary file.
Load this local file in QWebView.
The user can now enter required data into the local copy of this page.
Locate the form fields on this page, and pull the data the user entered using javascript. You can do this by getting the main frame object for the page (QWebView->Page()->MainFrame()), and then evaluating javascript code to accomplish the above task (use evaluateJavaScript()).
Take the data you have extracted from the form fields, and use it to submit the form with the connection you still have open with mechanize.
That's it! A bit of a work-around, but it works none-the-less :\

Auto fill a form from a different website

We have a webshop and using the shop's API we're able to fetch orders. On the other hand we have our wholesaler but they don't have an API, so we can't post orders to their system. They do have an online ordering form. Is there any way to auto fill this form from our script on our server to their script on their server?
I was googling the topic but I came across scripts that fill forms from the same page, not a different page on a different server.
p.s. this question is not intended to create spamming bots ;)
if i really understand that what u asked i think u must should use Selenium Web Driver that u can get information from a link and use them to auto fill the desired form , Selenium available on Java, Python , Ruby and ...

Categories