Form Fields
Basic usage
To add a new autofill rule, click the + button in the action bar below the rules table. To reorder a rule, click the
up/down icon and drag it up or down, or drag anywhere on the row where you see the move cursor (this can also be done using hotkeys). To perform an action on a rule, click one of the following buttons to the right of it:
- − – delete rule
- ❯ – move rule to another profile
Click the button in the action bar to toggle the search box. You can search for text in any of the columns in the rules table as well as the profile data (see below). Remember to click the Save button after you have modified one or more rules.
Autofill rules
These are the main rules that you define to automatically fill form fields on page load. A form field is used to submit information from the client (your browser) to the server. Below is a detailed description of each column in the rules table.
💡 TIP
The quickest way to define autofill rules is to use the infobar to automatically create all of the rules for you. It may not create perfect rules 100% of the time, but it provides a good starting point. No more digging through the source code!
Type
The type of autofill rule or the action you would like to execute.
Text – Select this to autofill text inputs (
<input type="text">,<input type="email">,<input type="number">,<input type="search">,<input type="color">,<input type="date">,<input type="range">,<input type="time">), hidden inputs (<input type="hidden">), multi-line text boxes (<textarea>), and iframe-based WYSIWYG edit boxes commonly found in forums and blogs.Password – Select this to autofill password fields (
<input type="password">).Select – Select this to auto-select dropdown menus and listboxes (
<select>).👇 NOTE
Many modern websites use frameworks like Bootstrap to render highly stylized dropdown menus constructed from
<div>elements. For these sites, you’ll need to find the hidden<select>elements bound to these “rich” dropdowns (usually immediately above them) to create your Select autofill rules. Some sites output the selected value to a hidden field. In such cases, creating a Type = Select rule won’t work; you’ll need to identify the hidden field used for that dropdown menu and create a Text rule instead.Checkbox/Radio – Select this to auto-check or uncheck checkboxes (
<input type="checkbox">) and radio buttons (<input type="radio">).JavaScript – Select this to execute arbitrary JavaScript code when the page loads (as soon as the DOM is ready). To execute JavaScript rules, you need to enable developer mode if you’re using Google Chrome or Microsoft Edge (this is a new MV3 security policy). Check out some sample JavaScript rules to get started.
💎 PRO
This feature is only available to Pro subscribers.
AUTOFILL…WAIT – See the Actions section below.
Name 🎞️
This is where you identify which form fields to autofill or elements to target in an action.
Syntax:
pattern– partial text match on the value of a supported HTML attribute; if not found, switch to CSS selector match"pattern"– exact text match on the value of a supported HTML attribute/pattern/– regular expressions (commonly shortened to “regex”) match on the value of a supported attribute//patternor/html/pattern– XPath match
💡 TIP
Regular expressions are a great way to match dynamic attribute values that change every time you load the web page. For example, here’s a pattern that matches “acme” followed by any number (\b is equivalent to the “Find whole words only” search option in Microsoft Word):
/\bacme\d+/
Regex ninjas can use more advanced features like lookbehind assertions (?<= and ?<!) to create highly complex text patterns such as the one below, which matches anything that contains “name” but is not immediately preceded by “first” or “last”:
/(?<!first|last)name/
You can create this rule and see it in action on the Practice Form. It should autofill these four fields: Full name (matching name="fullname"), Login (matching id="uname" and name="username"), Username (matching the “Username:” label text), and Name (matching id="message_name").
Supported HTML attributes:
aria-describedbyaria-labelaria-labelledbyautocomplete(except “on” and “off” values)class(this can match many fields, so use with caution)data-bind(Knockout)data-reactid(React)idnameng-model(AngularJS)placeholdersrc(only applicable to iframe-based rich text editors)titlevalue(only applicable to checkbox/radio inputs)
💡 TIP
To quickly inspect a field’s attributes, right-click on the field and select “Inspect” from the context menu to bring up the Elements panel of the developer tools; from here, you can select different elements and they should be highlighted for you on the page. Alternatively, you can also view the source code (Ctrl + U) and search for the field’s HTML tag manually.
Additional info:
- Text match is case insensitive (use regex to do a case sensitive match:
/pattern/). - Lines starting with
#<space>are ignored, so they are useful for comments. - Leading and trailing spaces are stripped.
- This column supports
{@variable_name},{_variable_name}, and{field ID}variable expansion (see Settings for more information).
Value
What you enter here depends on the rule type selected in the Type column.
- If Type = Text or Password, then enter the text that is to be autofilled.
- If Type = Select, then you can enter two types of values. First, you can enter the text or
valueattribute value of the option item you would like to auto-select. The value has to be double-quoted and regex is not supported in this context. You can also enter the index number of the option item to automatically select (the first item has an index of 0). For multi-select listboxes, separate each double-quoted value or index number with a pipe (|). Enter!or leave blank (1!and0!also work) to select or unselect all items in the list, respectively. Example: if you want to select the first and third items in a multiple selection listbox, then enter0|2(0 2also works); if you want to select A and C in a list comprising A, B, C, D, and E, then enter"A"|"C". Enter?to randomly select one item from the dropdown menu or multi-select list. - If Type = Checkbox/Radio, enter
1to check or0to uncheck. If it’s a checkbox or radio group and you can only match using thenameattribute, then you’ll have to specify1or0for each input in the group. Append!at the end to check/uncheck all items. Enter?to randomly toggle the checkbox. Example: if you want to check the second item in a four-item radio button group, then enter0100; to check all checkboxes, enter1!. - If Type = JavaScript, then enter the JavaScript code to execute here (or click Edit to edit it in the code editor). This opens up a world of possibilities if you are familiar with JavaScript. For example, you could add a rule to auto-submit the form after all fields have been autofilled. You can use JavaScript rules to simulate almost anything that a human can do, except at lightning speed (see rules.txt for some ideas).
- If Type = ACTION (AUTOFILL…WAIT), then see Actions section below.
Additional info:
- Text, Password, Select, Checkbox/Radio, and action rules support all variable types (see Settings for more information).
- JavaScript rules can reference variables defined in the Variables tab via the special
$()function. Example:console.log('My name is ' + $('name'));
Site
If you would like to activate Lightning Autofill only on certain websites, then enter any part of the document title (text inside <title> tag) or URL here. The title or URL of the site you’re on has to match the pattern you enter here to trigger the autofill. This allows you to define form fields to autofill on a per-site basis. If this box is left blank, then autofill will be triggered on all sites not matching what’s listed in the Exceptions tab.
Syntax:
pattern– partial text match on document title or URL"pattern"– exact text match on document title or URL/pattern/– regex match on document title or URL
💡 TIP
You can easily bind an autofill to more than one site by matching multiple domains using regex (e.g., /google\.com|yahoo\.com/).
Additional info:
- This overrides the profile site filter.
- Text match is case insensitive (use regex to do a case sensitive match).
- Lines starting with
#<space>are ignored, so they are useful for comments. - Leading and trailing spaces are stripped.
- This column only supports
{@variable_name}and{_variable_name}variables.
Mode
The form fill method to use when autofilling. This option is only applicable to Text and Password rules. Backup rules and hidden fields will always be filled using Safe mode.
- Safe – Select this to autofill only empty fields. This is the default.
- Overwrite – Select this to autofill all fields, including non-empty fields.
- Prepend – Select this to insert Value at the beginning of the field.
- Append – Select this to insert Value at the end of the field.
- Wrap – Select this to insert Value at the beginning and end of the field.
- Increment – Select this to add 1 to the existing field if it contains a number.
- Decrement – Select this to subtract 1 from the existing field if it contains a number.
Actions
Actions allow you to perform basic automation without any knowledge of JavaScript. They are the core commands of the upcoming macro recorder feature. To separate actions from the standard autofill rule types, they will always be displayed in ALL CAPS. For more complex automation, you can use JavaScript rules.
- AUTOFILL 🎞️ – Execute a profile, which processes all autofill rules inside that profile. Enter a profile ID to execute in the Value column. This action is equivalent to the
Autofill()function from the MV2 version of Lightning Autofill (v11.x.x and earlier). - CLICK 🎞️ – Click on an element. Enter a CSS selector or XPath to target the element to click in the Name column. This action is useful for going to the next step or auto-submitting forms after autofilling them.
- DISPATCH 🎞️ – Dispatch one or more JavaScript events to an element. Enter a CSS selector or XPath to target the element to send events to in the Name column. Enter the event names in the Value column. This action may be required for form fields that expect some event to be fired to trigger input validation, etc.
- OPEN 🎞️ – Open a web page. Enter the URL to open in the Value column. If you want to open the URL in a new tab, then add a
targetattribute value after the URL (separated by a space). It’s recommended to also set a site filter when using this action to prevent an endless loop of spawning new tabs. - RELOAD 🎞️ – Reload the web page until an element exists. Enter a CSS selector or XPath to target this element in the Name column. Enter the interval time in seconds (minimum = 1) in the Value column to reload the page at every interval. This action is useful for polling operations, such as reloading a product page until the product is in stock or an appointment time slot opens up.
- SCRAPE 🎞️ – Extract text from an element. Enter a CSS selector or XPath to target the element to scrape in the Name column. Enter the variable name to store the extracted text in in the Value column. Note that variable names can only contain letters and underscores, so all other characters will be stripped when defining the variable. If the variable is “my_name”, then you’ll be able to use this variable in subsequent autofill rules by entering
{_my_name}. - STYLE 🎞️ – Override the web page’s style with custom CSS. Enter one or more CSS rules to inject into the document in the Value column. If a CSS declaration isn’t working, try adding
!important. This action is useful to hide elements, highlight elements, and customize the page to your own liking. - WAIT 🎞️ – Wait before executing the next rule. Enter the delay time in seconds in the Value column. If you want to wait for an element to exist, then enter a CSS selector or XPath to target this element in the Name column, in which case the delay acts as a timeout. This action is useful on pages where elements are not matched on page load because they are added to the document dynamically after loading.
Profiles
Profiles allow you to organize your autofill rules and actions into different areas, like files in a folder. For example, you can have separate profiles for addresses, registrations, sweepstakes, account logins, and checkout. You can further group the profiles into categories in the “Execute profile” context menu by setting the “Context menu” option.
Lightning Autofill’s default behavior is to only process rules in the active profile. An active profile is the last profile you viewed in Options or the last profile you executed. If you want to execute all matching rules regardless of what the active profile is, then disable the “Autofill active profile only” option. You can override this behavior for some profiles or rules by setting all=true in the Advanced tab.
Action bar
The action bar contains controls and preferences for the currently selected (active) profile.
Add new rule – Click the + button to add a new rule to the profile.
Search rules – Click the button to toggle the search box, where you can instantly search for rules based on a case insensitive partial text match. Search will look in the following fields:
- Rule ID
- Rule type
- Rule name
- Rule value
- Rule site
- Rule mode
- Parent profile ID
- Parent profile name
- Parent profile hotkey
- Parent profile site
Profiles dropdown – Click the dropdown menu to switch between profiles. To view all rules across all profiles, select “All”. Rules added while viewing all profiles will be assigned to “Unfiled”. The number of rules in each profile is shown in parentheses next to the profile name. Select “Manage…” to open the Manage Profiles dialog, where you can do the following:
- Add new profiles
- Rename existing profiles
💡 TIP
If you set the option “Context menu = Group profiles by category”, then you can use the bulk rename operation to quickly assign profiles to a category. For example, to assign selected profiles to category “Personal”, enter
Personal > *into the Rename prompt. Similarly, if you have the “Profile expiration” option enabled, you can quickly append an expiration label at the end of the selected profiles by entering something like* [Expires: 2024-12-31]when prompted (this would auto-delete these profiles at the end of 2024).- Reorder profiles
- Delete profiles
👇 NOTE
If you delete an existing profile, you have the option to also delete all rules assigned to that profile or delete only the profile and move all rules to “Unfiled”. Shift- and Ctrl-click on multiple profiles to perform bulk operations on them.
- Duplicate profiles
- Export profiles to a CSV file
- Sort profiles alphabetically
Shift- and Ctrl-click on multiple profiles to perform bulk operations on them. After making changes, click the Save and Close button to save your changes. To discard all your changes, click Cancel, click anywhere outside the dialog, or press Esc (Escape).
Manage profiles – Click the button to bring up the Manage Profiles dialog. You can also access this from the profiles dropdown menu (see above).
Export profile – Click the button to export the current profile to a CSV file. If “All” profile is selected, then all profiles will be exported.
Hotkey – Enter a hotkey combination here to be able to quickly execute all the rules in this profile by pressing the assigned hotkey.
👇 NOTE
Some hotkeys may not work if there is a conflict with another software or extension, or if the hotkey is reserved by the operating system or browser.
Site – If you would like to restrict all of the autofill rules in a profile to a certain page or domain, then enter any part of the document title (text inside
<title>tag) or URL here. This is similar to the Site column in the rules table but works at the profile level. Note that rule-level site filters take priority over the profile site filter. This field follows the same syntax as the Site column except comments are not allowed. This field accepts{@variable_name}and{_variable_name}variables.