MCPcopy Create free account
hub / github.com/debbide/GeoFill / findField

Function findField

scripts/content.js:91–107  ·  view source on GitHub ↗

* 查找表单字段(单个)

(fieldName)

Source from the content-addressed store, hash-verified

89 * 查找表单字段(单个)
90 */
91function findField(fieldName) {
92 // 1. 优先尝试 CSS 选择器
93 const selectors = FIELD_SELECTORS[fieldName] || [];
94 for (const selector of selectors) {
95 try {
96 const element = document.querySelector(selector);
97 if (element && isVisible(element) && !element.disabled && !element.readOnly) {
98 return element;
99 }
100 } catch (e) {
101 // 忽略无效选择器
102 }
103 }
104
105 // 2. 尝试智能标签匹配
106 return findFieldByLabel(fieldName);
107}
108
109
110/**

Callers 1

fillFormFunction · 0.85

Calls 2

isVisibleFunction · 0.85
findFieldByLabelFunction · 0.85

Tested by

no test coverage detected