I want to automate submissions of TikTok copyright infringement reports with JavaScript. I have tried this code so far:
document.getElementsByName('name')[0].value = 'Name Here'
When I attempt to submit the form, the site clears the textbox and asks me to fill out this required field. Any clue what I am doing wrong? I have also tried this:
document.getElementsByName('name')[0].dispatchEvent(new Event('change'))
Without knowing exactly how that React form handles the input, it's hard to know what event needs triggering.
You can use Puppeteer to do this much easier, see this question for examples
Related
I know this is confusing and difficult because I have not code to show. Thats part of the problem, I dont really understand what is happening and I came here for some ideas.
In my job employees need to connect to two online systems.
The first one is programmed by me. Basically employees need to put some login credentials to enter our internal system to see their calendar, tasks, etc. Everything is good until here
The second system is a CRM site provided from an external providor. Users need to login into that system and the login credentials ARE THE SAME than the first system we have. We are loading this secondary page as an iframe inside the first system.
Considering our users already filled a login/password page I would like to fill automaticaly the second login form with the data we already have.
The problem is that somehow the login form of the CRM have some sort of validation system and if I use javascript to paste the login/password the "login button" remains disabled. The value is there and I can see it in the input field. That button only validates if an user fills the value with the keyboard or paste from the clipboard.
That is all I have at the moment and I dont know how to continue. Is there any way to simulate keyboard input or to ask the page to validate the content of the field? Any idea will be very appreciated.
I am trying to write a function that opens a new browser window and populate the email and login field and then click the submit button all from Javascript.
Lets say my domain is mynewweb.com and I want to open facebook.com/login page and populate the email and password fields from javascript code (such as document.getElementById) and then submit the form using some javascript code as well.
Is there any way of achieving that, any ideas. At the moment I am unable to achieve that I think its CORS issue but i'm not sure. But any idea of achieving that functionality or out of the box approach or something would be helpful.
Thanks
If I understand right, then you want a function that's not based on websites, but on browser functionality.
There are plenty of form filling plugins for different browsera, just look on their addons page.
So, I am trying to write a simple command chat bot for Twitch.tv chat, but I cannot seem to be able to get it to actually submit the text I add. Although I can add text and "click" the send button with JavaScript, it will not actually submit it.
For example, I can use http://www.twitch.tv/example to test it. Apparently it is not good practice on Stack Overflow to link to sites, but I do not know what else to do. I cannot recreate the problem in JS Fiddle because I do not know exactly what the problem is.
I can get these elements to seemingly work by using the Chrome console:
//finding the textbox
var textbox = document.getElementsByClassName("chat_text_input mousetrap ember-view ember-text-area")[0];
//then assign some text to it.
textbox.value = "Hello, World.";
This works fine and the text appears.
//to send it I should merely find a way to click the "send" button
var send = document.getElementsByClassName("button primary float-right send-chat-button")[0];
send.click();
Well, this does not really work. It only actually submits the text if I physically either type or use a character (like shift) inside the textbox, or physically click the button myself. So, from what I understand there is some sort of event that is triggered when I physically type and click. Unfortunately, I do not understand how to find/trigger this event through the console. This is what I want to do.
Preferably I would like to do this in pure JavaScript, but I believe it may be simpler in jQuery. If it absolutely has to be jQuery that's OK and I will just have to suck it up and learn.
As a side note, I was able to successfully use this (with the elements changed of course), for YouTube live streaming chat. However, several other websites' chat react similarly to Twitch. These include web skype.
I've spent the last few hours poking around Ember and Javascript to figure this out. I too was running into an issue where I had to either click into the chat area or the send button itself.
I thought I had a lead with a script made for Twitch Plays Pokemon which would send preset messages into the chat. It used Jquery to input the value into the textarea and click on the send button, but that no longer works as Twitch now uses Emberjs 2
I am not too familiar with the Ember framework, but it seems Twitch utilizes a Textarea component(in Ember terms), which associates some framework specific API to the Textarea HTML element.
Since the Twitch webapp is written with Ember, it would seem that using vanilla javascript to set the value of the textbox would not notify the property change to whatever observers are registered internally to Ember
The workaround would then be to change the value property via Ember internal methods. Luckily poking around the views associated on the Textarea DOM element gives access to the set method.
http://www.ember-doc.com/classes/Ember.TextArea.html#method_set
Ember.view.views worked pre-Ember 2 but was deprecated and now requires lookup
App.__container__.lookup('-view-registry:main')[document.querySelector(".chat_text_input").id].set("value","test");
document.querySelector(".chat-interface__submit").click();
I took a web programming courses a while ago but I'm essentially relearning everything from scratch.
I just want to build a very simply page using html/javascript that has a box for the user to enter a question or a phrase and a submit button.
When the user presses the submit button, the question/phrase instantly shows up in a bubble below. Each question/phrase must show up in a separate bubble and you can enter multiple questions/phrases.
I'm looking for suggestions of ways to accomplish this task using javascript.
I suggest using jQuery, an awesome javascript library that makes things easier.
http://jquery.com/
They have great tutorials at http://docs.jquery.com/Tutorials
With ajax and forms at http://docs.jquery.com/Tutorials:Safer_Contact_Forms_Without_CAPTCHAs#Simple_Contact_Form:
I started to edit a magento template and I stumbled upon an error: if I miss a required field and click the submit button, the "this is a required field" text appears underneath the respective field; but when I recomplete the form and click the 'submit" button for the second time, I realise that it is blocked.
Has anyone gone through the same thing? I don't know javascript at all and I'm not able to do it myself.
Im in a great need of getting this done, so please, lend me a hand.
For anyone else who finds this question: I ran into this issue and after much debugging realised that it was because I had removed scriptaculous/effects.js from the layout of the checkout page.
The form validation JS depends on effects.js, but the code that uses it is inside a try/catch block meaning that you will not get console errors, and instead the form will just fail to revalidate correctly.
Take a look at this link it will give an explanation of the javascript validation in Magento. the thing to look for is the class in the text/select fields if it has required or any of the other ones listed in the link, it will run the validation through those.
http://fishpig.co.uk/magento-tutorials/magento-forms-prototype-javascript-validation