I try to automate a page using a script in the js console. I'm able to set an input to a field, but it's not used. When applying.
I tried setting it using:
document.getElementById("foo").value = "text"
This fills the input but if I try to apply the value it seems to be ignored.
The website seems to only save values which are typed using the keyboard.
Is there a way to simulate this in the js console or any other ways I could test instead of setting the value using above method.
Related
I am attempting to create a simple chrome extension autofill for Stripe Checkout pages. Chromes default autofill functions like expected however when trying to use my extensions autofill code to input values into the forms like so
document.getElementById("ID").value = "value"
the value is input initially but will be automatically removed for any number of reasons, like clicking outside of the input or anywhere else on the page will have the value of the input removed. I have tried a few different things like firing all of the necessary events for keyboard input like keyup,keydown,input, change ect and I can not get the value to stick.
I believe that stripe is using some JS to check whether or not the events sent to the input were trusted and if not it is removing the values. for this reason I have attempted to use Chromes Debugger API to send commands directly to the browser. I have found a command that seems like it will work for what I need. The "Input.dispatchKeyEvent" command appears to be what I need but I do not see a way to specify what element the keys are being sent to.
chrome.debugger.sendCommand({tabId:TAB_ID}, "Input.dispatchKeyEvent",{type:"char"})
How Can I Prevent The Values From Being Removed?
Is There A Way To Send trusted key Events To A Specific Element On The Page Using The Debugger?
An Example Of A Stripe Checkout Page Can Be Found Here Click Pay Now To Be Brought To A Testing Page
https://demo.wpsimplepay.com/stripe-checkout/
Command Docs
https://chromedevtools.github.io/devtools-protocol/1-3/Input/#method-dispatchKeyEvent
I don't think is something you'll be able to do, as I'd expect Stripe would want to avoid auto-filling of card details from anything other than the browser or a trusted application.
I am trying to create Azure DevOps extension where, I want to copy(assign) value of one field to another field when the System.State is "todo". Is there a way this can by achieved using onFieldChanged event in Azure DevOps?
As shown in the image attached, I want to display the text written in System.Title in System.Description using onChange event. Is it achievable using extension?
I followed Microsoft documentation on creating simple extension using html, JavaScript, vss-extension.json. Couldn't find how the events and fields works in extensions.
We recommend that you use custom rule to copy value of one field to another field when the System.State is To Do.
Sample and result:
Update1
We can create extension to copy value of one field to another field. We can use onFieldChanged to get the field value and copy the value to another field. Here is an sample to get work item detail via the event onFieldChanged, please check it.
So I am using vue.js to build my UI and I am using the html DOM property validity along with rules on my input tags(pattern, minLength, maxLength etc.) It seems like the validity property only gets set if I edit the text box manually. If I programatically assign an invalid value to my variable bound to the input tag with v-model, the validity property is not working as expected. It only works if I actually enter something into the input. I have tried programatically firing off keyup and change events for the input box to try and get it to validate and it is not working. Has anyone encountered this before? I know there are good plugins for validating with vuejs but I would prefer to use the built in HTML5 functionality.
If you want to see code samples reply in comments.
I am doing a school project, working on a website that uses forms to send user data to Mailchimp. The site uses Angularjs to control its inputs (I have no access to this code, nor any knowledge about Angularjs).
What I am trying to accomplish
I want my script to insert whatever text is saved in the 'personalitet' span into the input by name 'form[5606]' and accept it as as filled out, without any interaction from the user.
But Angularjs is refusing to see the input at filled out without the user interacting with the field, what can I do?
How do I trigger the input or change event without having access to the Angularjs script or the HTML markup with external JavaScript?
My Script
var personalitet = document.getElementById("personalitet").innerHTML;
document.getElementsByName("form[5606]")[0].value = personalitet;
The site can be accessed here: site
I have tried using, without luck:
input.trigger('input');
input.trigger('change');
Finally managed to make it work and all that was needed was a .change to tell Angularjs that the input value had changed. As such, the final scrip was:
var personalitet = document.getElementById("personalitet").innerHTML;
document.getElementsByName("form[5607]")[0].value = personalitet;
$( "input[name='form[5607]']" ).change();
Currently I have a social media plugin and you can change what it says by adding a data-text field so it will look like data-text = "something" and this works nicely but I want it to change for different pages.
I currently have set up some javascript to get the input i want and save it in a variable. Is there a way I can populate the data-text field with it?
Originally I thought to use some razor code because that will break the quotation marks and cause it to accept the razor as code and not plain text. But I was running into problems with the page not loading my razor code at all.
You're talking about an attribute, not a field.
$('.my-element').attr('data-text', myVariable);