auto fill form without id tampermonkey
I personally prefer to use jQuery over pure javascript in tampermonkey because it gives me more control such as loading the script when the DOM is ready. i.e. wrap the function in a $(document).ready(function() ...
you can try this out (make sure to change the @match)/p>
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match <your site here>
// @icon https://www.google.com/s2/favicons?sz=64&domain=undefined.
// @grant none
// @require http://code.jquery.com/jquery-3.4.1.min.js
// ==/UserScript==
(function() {
'use strict';
$(document).ready(function() {
var mail = "test@gmail.com";
$('[name=user_email]').val(mail);
});
})();
How to automatically fill the fields of a form in a webview?
You need to wait the entire web page loads, including its content (id="paypalAccountData_firstName"
)
So you should change
view.loadUrl("javascript:document.getElementById('paypalAccountData_firstName').value = 'test';");
to
view.loadUrl( "javascript:window.onload= (function(){ document.getElementById('paypalAccountData_firstName').value = 'test';})();");
Related Topics
Javascript to Download a File from Amazon S3 Bucket
Running Functions One After Other in React
How to Format Numbers by Prepending 0 to Single-Digit Numbers
How to Redirect to Another Page Using Angularjs
How to Make a Auto-Increment Id in My Table Td Using Jquery
How to Sort Elements in an Array into Order and Even Numbers and They Should Be in Ascending Order
Disable Right-Clicking in Html5 Video
Run Script After Appending It to the HTML
Add Hyphen After Every Fourth Character in a String Seperated by Comma
How to Synchronize the Scroll Position of Two Divs
How to Find If a Text Contains Url String
Regular Expression Which Allow Only Characters or Space
Preventing Page from Scrolling on Focus Switching
Increase Counter Value Upon Button Click
Why Flatlist Is Not Updating Dynamically in React Native
Want to Show/Hide Div Based on Dropdown Box Selection
How to Disable Eslint Rule Max Line Length for Paragraph in <Template> of Vue.Js