How to programmatically fill out a Formik form in a React application while its components are not exposed to the DOM #3759
Unanswered
Nirvanatin
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How can I programmatically fill out a form that is built using Formik in a React application and ensure that the form is filled up identically to how a person would fill out the form manually?
One issue I am encountering is that the page is using the production build of React, and its components are not exposed to the DOM (for example, the Formik context object). I have identified a list of properties that I can view in the React Developer Tools extension, but I am concerned that these properties may not be triggered or filled properly if I try to automate the page.
The list of properties I am considering includes
handleChange
,handleBlur
,touched
,validateForm
,validateField
,isSubmitting
,submitCount
, and nested objects. The form contains nested objects, such as city or agency IDs, so I need to ensure that these fields are properly populated with the correct values before setting their values. Additionally, I am not sure if any of the form fields have asynchronous updates or side effects. If there are any asynchronous updates, I need to ensure that these updates are properly triggered and resolved before submitting the form.For certain reasons, I prefer not to use BeautifulSoup or Selenium. I have attempted to use the code provided below, but it has failed to properly fill out the form.
Beta Was this translation helpful? Give feedback.
All reactions