Save a Named Field as Unnamed Field
For any form field that has either the
id attribute, Fake Data saves them as Named Fields, but sometimes just want to identify a field based on a unique custom selector.
For this scenario, you can save a Named Field as Unnamed Fields and identify them by their selector.
Here is how to do that:
First, let's make sure that you have the "Fallback to Unnamed Fields" option enabled:
- Open Fake Data's Options page
- Go to Settings -> Developer Options -> Field Matching
- Make sure that "Fallback Named Fields to Unnamed Fields" option is set to "Fallback to Unnamed Fields"
Now, in order to identify a named field by it's selector, you can do the following:
- Inside the page where your input field is located, right-click on the input element that you want to manage, then go to Fake Data submenu and choose "Manage Field" option
- In the newly opened popup, on the Save Field as toggle, choose Unnamed Field.
The "Save Field as" option will only show for fields that have a `name` or `id` attribute.
- Now you should see that the field identifier has changed to a URL@selector format. This indicates that the input field will be identified by this selector on the page identified by the URL.
- Optionally, you can customise the selector to anything you want by pressing the Edit button, which looks like this:
- Once finished, press the green Save button, and you will be taken back to your form page.
- Now you should be able to fill any similar input fields on the page that matches the selector you used in the steps just described.
Below is a quick demo showing all steps described above: