Error: Not implemented: HTMLFormElement.prototype.submit

See original GitHub issue

Error

HTMLInputElement {} HTMLInputElement {}
Error: Not implemented: HTMLFormElement.prototype.submit
    at module.exports (/home/xlmnxp/Documents/Nodejs/DownFrom99/node_modules/jsdom/lib/jsdom/browser/not-implemented.js:9:17)
    at HTMLFormElementImpl.submit (/home/xlmnxp/Documents/Nodejs/DownFrom99/node_modules/jsdom/lib/jsdom/living/nodes/HTMLFormElement-impl.js:68:5)
    at HTMLFormElement.submit (/home/xlmnxp/Documents/Nodejs/DownFrom99/node_modules/jsdom/lib/jsdom/living/generated/HTMLFormElement.js:18:21)
    at /home/xlmnxp/Documents/Nodejs/DownFrom99/app.js:12:10
    at process._tickCallback (internal/process/next_tick.js:109:7) undefined
import { JSDOM } from "jsdom";

JSDOM.fromURL("http://localhost/").then((dom:JSDOM) => {
    let document = dom.window.document;
    let window = dom.window;

    let form = <HTMLFormElement> document.querySelector("form");
    let urlField = <HTMLInputElement> document.querySelector("input[name='formvalue']");
    let submitButton = <HTMLInputElement> document.querySelector("input[type='submit']");

    console.log(submitButton,urlField)
    
    urlField.value = "https://www.youtube.com/watch?v=RWjDLfx8Lww";

    form.submit()
    
})

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:30 (5 by maintainers)

github_iconTop GitHub Comments

53reactions
domeniccommented, Aug 10, 2017

Yes, indeed, form submission is not implemented. This is working as expected.

33reactions
ssolderscommented, Feb 8, 2019

Ran into this when writing tests using Jest. My workaround:

window.HTMLFormElement.prototype.submit = () => {}

Added this before I mount my component in the test case. At least it keeps my console clean.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Not implemented: HTMLFormElement.prototype.submit
I am receiving "Error: Not implemented: HTMLFormElement.prototype.submit". I tried the solution mentioned here https://github.com/jsdom/jsdom/ ...
Read more >
Error: Not implemented: HTMLFormElement.prototype.submit
Error : Not implemented: HTMLFormElement.prototype.submit ... a real form submission with Jest and JSDOM, you have probably seen this error:
Read more >
Not implemented: HTMLFormElement.prototype.submit-Reactjs
I had to mock the implementation of my onSubmit function to clear the error, preventing the default submit behavior. Give something like this...
Read more >
form.submit is not a function - TrackJS
In this case, we had a reference to a HTMLFormElement , which should have a submit function on its prototype. This is a...
Read more >
HTMLFormElement.submit() - Web APIs | MDN
The HTMLFormElement.submit() method submits a given <form> . This method is similar, but not identical to, activating a form's submit ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found