job-apply-cli 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- job_apply_agent/__init__.py +3 -0
- job_apply_agent/api.py +340 -0
- job_apply_agent/ats/__init__.py +12 -0
- job_apply_agent/ats/answer_binding.py +308 -0
- job_apply_agent/ats/base.py +64 -0
- job_apply_agent/ats/captcha.py +76 -0
- job_apply_agent/ats/codex_planner.py +174 -0
- job_apply_agent/ats/cua_harness.py +846 -0
- job_apply_agent/ats/dom_browser.py +275 -0
- job_apply_agent/ats/form_preparation.py +452 -0
- job_apply_agent/ats/hybrid_harness.py +379 -0
- job_apply_agent/ats/lcu_bridge.mjs +94 -0
- job_apply_agent/ats/lcu_harness.py +226 -0
- job_apply_agent/ats/lcu_worker.sh +12 -0
- job_apply_agent/ats/page_readiness.py +119 -0
- job_apply_agent/ats/playwright_adapter.py +561 -0
- job_apply_agent/cli.py +108 -0
- job_apply_agent/collectors/__init__.py +7 -0
- job_apply_agent/collectors/ashby.py +64 -0
- job_apply_agent/collectors/base.py +75 -0
- job_apply_agent/collectors/greenhouse.py +50 -0
- job_apply_agent/collectors/job_link.py +471 -0
- job_apply_agent/collectors/lever.py +42 -0
- job_apply_agent/collectors/normalizer.py +156 -0
- job_apply_agent/config.py +190 -0
- job_apply_agent/db.py +40 -0
- job_apply_agent/domain/__init__.py +11 -0
- job_apply_agent/domain/enums.py +50 -0
- job_apply_agent/domain/schemas.py +173 -0
- job_apply_agent/examples/__init__.py +1 -0
- job_apply_agent/examples/answer-bank.json +7 -0
- job_apply_agent/examples/experiences.json +8 -0
- job_apply_agent/examples/profile.json +24 -0
- job_apply_agent/examples/search-policy.json +15 -0
- job_apply_agent/examples/source-boards.json +10 -0
- job_apply_agent/experience/__init__.py +1 -0
- job_apply_agent/experience/benchmark.py +199 -0
- job_apply_agent/experience/library.py +140 -0
- job_apply_agent/experience/reasoning.py +240 -0
- job_apply_agent/experience/retrieval.py +221 -0
- job_apply_agent/managed_apply.py +104 -0
- job_apply_agent/managed_backlog.py +410 -0
- job_apply_agent/models.py +133 -0
- job_apply_agent/onboarding.py +152 -0
- job_apply_agent/repository.py +54 -0
- job_apply_agent/resume/__init__.py +3 -0
- job_apply_agent/resume/composer.py +121 -0
- job_apply_agent/scheduler.py +115 -0
- job_apply_agent/services/__init__.py +18 -0
- job_apply_agent/services/answer_derivation.py +59 -0
- job_apply_agent/services/answers.py +71 -0
- job_apply_agent/services/application_report.py +144 -0
- job_apply_agent/services/artifacts.py +38 -0
- job_apply_agent/services/codex_narratives.py +64 -0
- job_apply_agent/services/facts.py +57 -0
- job_apply_agent/services/model_errors.py +93 -0
- job_apply_agent/services/narratives.py +278 -0
- job_apply_agent/services/orchestrator.py +149 -0
- job_apply_agent/services/policy.py +173 -0
- job_apply_agent/services/quota.py +88 -0
- job_apply_agent/services/resumes.py +86 -0
- job_apply_agent/services/review_actions.py +120 -0
- job_apply_agent/tasks.py +775 -0
- job_apply_agent/telegram/__init__.py +1 -0
- job_apply_agent/telegram/experiences.py +105 -0
- job_apply_agent/telegram/review.py +494 -0
- job_apply_cli-0.2.0.dist-info/METADATA +330 -0
- job_apply_cli-0.2.0.dist-info/RECORD +71 -0
- job_apply_cli-0.2.0.dist-info/WHEEL +4 -0
- job_apply_cli-0.2.0.dist-info/entry_points.txt +3 -0
- job_apply_cli-0.2.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import asyncio
|
|
4
|
+
import json
|
|
5
|
+
import os
|
|
6
|
+
import re
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any
|
|
9
|
+
from urllib.parse import urlparse
|
|
10
|
+
|
|
11
|
+
from .cua_harness import UnsafeComputerAction, scroll_amount
|
|
12
|
+
|
|
13
|
+
_ROW = re.compile(r"^(\s*)(\d+) (.+)$")
|
|
14
|
+
_ROLE = re.compile(
|
|
15
|
+
r"^(entry|text field|text area|text input|textbox|push button|button|check box|"
|
|
16
|
+
r"radio button|toggle button|combo box|list item|menu item|link)\b"
|
|
17
|
+
)
|
|
18
|
+
_SUBMIT = re.compile(r"submit|send application|apply now|complete application", re.IGNORECASE)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def document_observation(text: str, *, url: str, generation: int) -> dict[str, Any]:
|
|
22
|
+
"""Only expose descendants of the web document, never browser chrome."""
|
|
23
|
+
if "Accessibility source: at_spi" not in text:
|
|
24
|
+
raise UnsafeComputerAction("LCU accessibility tree unavailable")
|
|
25
|
+
depth: int | None = None
|
|
26
|
+
document_ref: str | None = None
|
|
27
|
+
outline: list[str] = []
|
|
28
|
+
refs: list[dict[str, Any]] = []
|
|
29
|
+
for line in text.splitlines():
|
|
30
|
+
match = _ROW.match(line)
|
|
31
|
+
if not match:
|
|
32
|
+
continue
|
|
33
|
+
indent, index, body = match.groups()
|
|
34
|
+
if body.startswith("document web"):
|
|
35
|
+
if depth is not None:
|
|
36
|
+
raise UnsafeComputerAction("LCU found multiple web documents")
|
|
37
|
+
depth = len(indent)
|
|
38
|
+
document_ref = f"p{generation}:{index}"
|
|
39
|
+
outline.append(line)
|
|
40
|
+
continue
|
|
41
|
+
if depth is None:
|
|
42
|
+
continue
|
|
43
|
+
if len(indent) <= depth:
|
|
44
|
+
break
|
|
45
|
+
outline.append(line)
|
|
46
|
+
role_match = _ROLE.match(body)
|
|
47
|
+
if not role_match or re.search(r"\b(disabled|unavailable)\b", body):
|
|
48
|
+
continue
|
|
49
|
+
role = role_match[1]
|
|
50
|
+
detail = body[len(role) :].strip()
|
|
51
|
+
name = re.sub(r"^\([^)]*\)\s*", "", detail)
|
|
52
|
+
name = re.split(r", (?:Value|Secondary Actions):", name, maxsplit=1)[0]
|
|
53
|
+
state = re.match(r"^\(([^)]*)\)", detail)
|
|
54
|
+
actions = ["click"]
|
|
55
|
+
if role in {"entry", "text field", "text area", "text input", "textbox"} or (
|
|
56
|
+
role == "combo box" and state and "settable" in state[1].split(", ")
|
|
57
|
+
):
|
|
58
|
+
actions.append("fill")
|
|
59
|
+
if _SUBMIT.search(name):
|
|
60
|
+
actions = []
|
|
61
|
+
refs.append(
|
|
62
|
+
{
|
|
63
|
+
"ref": f"p{generation}:{index}",
|
|
64
|
+
"role": role,
|
|
65
|
+
"name": name,
|
|
66
|
+
"actions": actions,
|
|
67
|
+
"state": state[1] if state else "",
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
if depth is None:
|
|
71
|
+
raise UnsafeComputerAction("LCU returned no web document")
|
|
72
|
+
return {
|
|
73
|
+
"page": {"url": url},
|
|
74
|
+
"outline": "\n".join(outline),
|
|
75
|
+
"refs": refs,
|
|
76
|
+
"document_ref": document_ref,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class LcuBrowserSession:
|
|
81
|
+
"""LCU native AT-SPI actions, bound to the worker's single Chromium page."""
|
|
82
|
+
|
|
83
|
+
def __init__(self, process: Any, page: Any, timeout: int):
|
|
84
|
+
self.process = process
|
|
85
|
+
self.page = page
|
|
86
|
+
self.origin = urlparse(page.url).netloc
|
|
87
|
+
self.timeout = timeout
|
|
88
|
+
self.generation = 0
|
|
89
|
+
self.latest: dict[str, Any] | None = None
|
|
90
|
+
|
|
91
|
+
@classmethod
|
|
92
|
+
async def attach(
|
|
93
|
+
cls, *, page: Any, browser_pid: int, prefix: Path, node_path: Path, timeout_seconds: int
|
|
94
|
+
) -> LcuBrowserSession:
|
|
95
|
+
# Never leak GLM, database, Telegram or other production credentials to LCU.
|
|
96
|
+
keep = {
|
|
97
|
+
"PATH",
|
|
98
|
+
"HOME",
|
|
99
|
+
"USER",
|
|
100
|
+
"LOGNAME",
|
|
101
|
+
"DISPLAY",
|
|
102
|
+
"XAUTHORITY",
|
|
103
|
+
"DBUS_SESSION_BUS_ADDRESS",
|
|
104
|
+
"LANG",
|
|
105
|
+
"LC_ALL",
|
|
106
|
+
"TMPDIR",
|
|
107
|
+
"XDG_RUNTIME_DIR",
|
|
108
|
+
"AT_SPI_BUS_ADDRESS",
|
|
109
|
+
}
|
|
110
|
+
process = await asyncio.create_subprocess_exec(
|
|
111
|
+
str(node_path),
|
|
112
|
+
str(Path(__file__).with_name("lcu_bridge.mjs")),
|
|
113
|
+
str(prefix),
|
|
114
|
+
env={k: v for k, v in os.environ.items() if k in keep},
|
|
115
|
+
stdin=asyncio.subprocess.PIPE,
|
|
116
|
+
stdout=asyncio.subprocess.PIPE,
|
|
117
|
+
stderr=asyncio.subprocess.DEVNULL,
|
|
118
|
+
limit=2**22,
|
|
119
|
+
)
|
|
120
|
+
browser = cls(process, page, timeout_seconds)
|
|
121
|
+
try:
|
|
122
|
+
await browser._request({"op": "init", "pid": browser_pid})
|
|
123
|
+
await browser.observe()
|
|
124
|
+
return browser
|
|
125
|
+
except BaseException:
|
|
126
|
+
await browser.close()
|
|
127
|
+
raise
|
|
128
|
+
|
|
129
|
+
async def _request(self, request: dict) -> dict:
|
|
130
|
+
async with asyncio.timeout(self.timeout):
|
|
131
|
+
self.process.stdin.write((json.dumps(request) + "\n").encode())
|
|
132
|
+
await self.process.stdin.drain()
|
|
133
|
+
line = await self.process.stdout.readline()
|
|
134
|
+
if not line:
|
|
135
|
+
raise UnsafeComputerAction("LCU bridge exited without a response")
|
|
136
|
+
result = json.loads(line)
|
|
137
|
+
if not result.get("ok"):
|
|
138
|
+
raise UnsafeComputerAction(result.get("error", "LCU bridge error"))
|
|
139
|
+
return result
|
|
140
|
+
|
|
141
|
+
def _check_scope(self) -> None:
|
|
142
|
+
if urlparse(self.page.url).netloc != self.origin:
|
|
143
|
+
raise UnsafeComputerAction("LCU page navigated outside the initial ATS origin")
|
|
144
|
+
if len(self.page.context.pages) != 1:
|
|
145
|
+
raise UnsafeComputerAction("LCU requires exactly one browser tab")
|
|
146
|
+
|
|
147
|
+
async def observe(self) -> dict[str, Any]:
|
|
148
|
+
self._check_scope()
|
|
149
|
+
result = await self._request({"op": "observe"})
|
|
150
|
+
self.generation += 1
|
|
151
|
+
self.latest = document_observation(
|
|
152
|
+
result["text"], url=self.page.url, generation=self.generation
|
|
153
|
+
)
|
|
154
|
+
return self.latest
|
|
155
|
+
|
|
156
|
+
async def execute(self, action: dict, observation: dict) -> bool:
|
|
157
|
+
self._check_scope()
|
|
158
|
+
if observation is not self.latest:
|
|
159
|
+
raise UnsafeComputerAction("LCU action uses a stale observation")
|
|
160
|
+
if action["action"] == "stop":
|
|
161
|
+
raise UnsafeComputerAction(action.get("reason") or "planner requested review")
|
|
162
|
+
if action["action"] == "finish":
|
|
163
|
+
return True
|
|
164
|
+
if action["action"] == "scroll":
|
|
165
|
+
fresh = await self.observe()
|
|
166
|
+
self._check_scope()
|
|
167
|
+
await self._request(
|
|
168
|
+
{
|
|
169
|
+
"op": "action",
|
|
170
|
+
"action": "scroll",
|
|
171
|
+
"index": int(fresh["document_ref"].split(":")[1]),
|
|
172
|
+
"value": max(-1200, min(1200, scroll_amount(action.get("value")))),
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
self.latest = None
|
|
176
|
+
return False
|
|
177
|
+
target = next((r for r in observation["refs"] if r["ref"] == action.get("ref")), None)
|
|
178
|
+
if not target or action["action"] not in target["actions"]:
|
|
179
|
+
raise UnsafeComputerAction(
|
|
180
|
+
f"LCU action {action['action']!r} with ref {action.get('ref')!r} "
|
|
181
|
+
"is not allowed in the current document"
|
|
182
|
+
)
|
|
183
|
+
if _SUBMIT.search(target["name"]):
|
|
184
|
+
raise UnsafeComputerAction("Final submission belongs to the deterministic host")
|
|
185
|
+
|
|
186
|
+
# The ATS may replace AX nodes while the model is thinking (for example
|
|
187
|
+
# after uploading a resume). Native indices are not durable identities.
|
|
188
|
+
# Rebind only a uniquely named control with the same role; never reuse
|
|
189
|
+
# an old index or guess between repeated Yes/No controls.
|
|
190
|
+
def matches(candidate: dict) -> bool:
|
|
191
|
+
return candidate["name"] == target["name"] and candidate["role"] == target["role"]
|
|
192
|
+
|
|
193
|
+
if not target["name"] or sum(matches(r) for r in observation["refs"]) != 1:
|
|
194
|
+
raise UnsafeComputerAction("LCU target has no unique accessible identity")
|
|
195
|
+
fresh = await self.observe()
|
|
196
|
+
candidates = [r for r in fresh["refs"] if matches(r)]
|
|
197
|
+
if len(candidates) != 1 or action["action"] not in candidates[0]["actions"]:
|
|
198
|
+
raise UnsafeComputerAction("LCU target changed before execution; replan required")
|
|
199
|
+
current = candidates[0]
|
|
200
|
+
if target["role"] in {"check box", "radio button", "toggle button"}:
|
|
201
|
+
selection = re.compile(
|
|
202
|
+
r"\b(?:not pressed|pressed|unpressed|checked|unchecked|selected|unselected|on|off)\b"
|
|
203
|
+
)
|
|
204
|
+
if selection.findall(target["state"]) != selection.findall(current["state"]):
|
|
205
|
+
raise UnsafeComputerAction("LCU selection changed before execution")
|
|
206
|
+
self._check_scope()
|
|
207
|
+
await self._request(
|
|
208
|
+
{
|
|
209
|
+
"op": "action",
|
|
210
|
+
"action": action["action"],
|
|
211
|
+
"index": int(current["ref"].split(":")[1]),
|
|
212
|
+
"value": action.get("value"),
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
self.latest = None
|
|
216
|
+
return False
|
|
217
|
+
|
|
218
|
+
async def close(self) -> None:
|
|
219
|
+
if self.process.returncode is not None:
|
|
220
|
+
return
|
|
221
|
+
try:
|
|
222
|
+
self.process.stdin.close()
|
|
223
|
+
await asyncio.wait_for(self.process.wait(), timeout=5)
|
|
224
|
+
except (TimeoutError, BrokenPipeError):
|
|
225
|
+
self.process.kill()
|
|
226
|
+
await self.process.wait()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -eu
|
|
3
|
+
/usr/libexec/at-spi-bus-launcher --launch-immediately --a11y=1 --screen-reader=1 &
|
|
4
|
+
sleep 1
|
|
5
|
+
AT_SPI_BUS_ADDRESS=$(gdbus call --session --dest org.a11y.Bus \
|
|
6
|
+
--object-path /org/a11y/bus --method org.a11y.Bus.GetAddress | cut -d "'" -f 2)
|
|
7
|
+
test -n "$AT_SPI_BUS_ADDRESS"
|
|
8
|
+
export AT_SPI_BUS_ADDRESS
|
|
9
|
+
if [ "$#" -gt 0 ]; then
|
|
10
|
+
exec "$@"
|
|
11
|
+
fi
|
|
12
|
+
exec python -m dramatiq job_apply_agent.tasks --processes 1 --threads 1
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"""Wait for application UI and retain field identity across DOM replacement."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import re
|
|
7
|
+
import time
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from .captcha import CAPTCHA_EVIDENCE_JS
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class FieldBindingError(RuntimeError):
|
|
14
|
+
"""A previously inspected field can no longer be identified safely."""
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
async def wait_for_application_surface(page: Any, *, timeout_ms: int = 30_000) -> dict:
|
|
18
|
+
"""Wait for useful application UI, not merely DOMContentLoaded or site navigation."""
|
|
19
|
+
started = time.monotonic()
|
|
20
|
+
handle = await page.wait_for_function(
|
|
21
|
+
r"""() => {
|
|
22
|
+
const visible = el => el.getClientRects().length > 0 &&
|
|
23
|
+
getComputedStyle(el).visibility !== 'hidden';
|
|
24
|
+
const fields = [...document.querySelectorAll(
|
|
25
|
+
'input:not([type=hidden]),textarea,select,[role=combobox],'
|
|
26
|
+
+ '.ashby-application-form-field-entry [aria-pressed],fieldset [aria-pressed]'
|
|
27
|
+
)].filter(el => !el.disabled && visible(el));
|
|
28
|
+
if (fields.length) return {reason: 'form_controls', controls: fields.length};
|
|
29
|
+
if ([...document.querySelectorAll('.file-upload__filename,.ashby-application-form-input-file-item')]
|
|
30
|
+
.some(visible)) return {reason: 'uploaded_attachment'};
|
|
31
|
+
const entry = [...document.querySelectorAll('a,button,[role=button],[role=tab]')]
|
|
32
|
+
.find(el => visible(el) && !el.disabled &&
|
|
33
|
+
/\bapply\b|^application$/i.test(
|
|
34
|
+
(el.innerText || el.getAttribute('aria-label') || '').trim()));
|
|
35
|
+
if (entry) return {reason: 'application_entry'};
|
|
36
|
+
const challenge = (__CAPTCHA_PROBE__)().some(
|
|
37
|
+
item => ['challenge','visible_unknown'].includes(item.state)) ||
|
|
38
|
+
[...document.querySelectorAll('input[autocomplete="one-time-code"]')].some(visible);
|
|
39
|
+
if (challenge) return {reason: 'challenge_visible'};
|
|
40
|
+
const text = (document.body?.innerText || '').trim();
|
|
41
|
+
const unavailable = /job not found|position (?:is )?(?:closed|no longer available)|job (?:is )?no longer available|page not found/i;
|
|
42
|
+
if (unavailable.test(text)) {
|
|
43
|
+
return {reason: 'unavailable_message'};
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}""".replace("__CAPTCHA_PROBE__", CAPTCHA_EVIDENCE_JS),
|
|
47
|
+
polling=200,
|
|
48
|
+
timeout=timeout_ms,
|
|
49
|
+
)
|
|
50
|
+
try:
|
|
51
|
+
result = await handle.json_value()
|
|
52
|
+
finally:
|
|
53
|
+
await handle.dispose()
|
|
54
|
+
return {**result, "waited_seconds": round(time.monotonic() - started, 3)}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
async def locate_inspected_field(page: Any, binding: dict, *, timeout_ms: int = 30_000):
|
|
58
|
+
"""Prefer the original native ID/name; never rebind by generated field position."""
|
|
59
|
+
if binding.get("dom_id"):
|
|
60
|
+
attribute, value = "id", binding["dom_id"]
|
|
61
|
+
locator = page.locator(f"[{attribute}={json.dumps(value)}]")
|
|
62
|
+
elif binding.get("dom_name"):
|
|
63
|
+
attribute, value = "name", binding["dom_name"]
|
|
64
|
+
locator = page.locator(f"[{attribute}={json.dumps(value)}]")
|
|
65
|
+
elif binding.get("label") and binding["input_type"] != "file":
|
|
66
|
+
# Anonymous controls lose generated markers on hydration. Rebind only by
|
|
67
|
+
# their observed accessible label/placeholder, with strict uniqueness and
|
|
68
|
+
# the same type/label validation below.
|
|
69
|
+
locator = page.get_by_label(binding["label"], exact=True).or_(
|
|
70
|
+
page.get_by_placeholder(binding["label"], exact=True)
|
|
71
|
+
)
|
|
72
|
+
else:
|
|
73
|
+
attribute, value = "data-job-apply-field-id", binding["field_id"]
|
|
74
|
+
locator = page.locator(f"[{attribute}={json.dumps(value)}]")
|
|
75
|
+
locator = locator.and_(
|
|
76
|
+
page.locator(
|
|
77
|
+
"input:not([disabled]),textarea:not([disabled]),select:not([disabled]),"
|
|
78
|
+
"[role=combobox]:not([aria-disabled=true])"
|
|
79
|
+
)
|
|
80
|
+
)
|
|
81
|
+
if binding["input_type"] != "file":
|
|
82
|
+
locator = locator.and_(page.locator(":visible"))
|
|
83
|
+
# Locator resolves again on each action, so React replacing the node does not
|
|
84
|
+
# strand us on our temporary marker. Strict matching rejects duplicate IDs/names.
|
|
85
|
+
await locator.wait_for(state="attached", timeout=timeout_ms)
|
|
86
|
+
actual = await locator.evaluate(
|
|
87
|
+
"""el => {
|
|
88
|
+
const described = el.getAttribute('aria-labelledby');
|
|
89
|
+
const group = el.closest('fieldset,.ashby-application-form-field-entry,.application-question');
|
|
90
|
+
const groupLabel = (group?.querySelector('legend,.ashby-application-form-question-title,.application-label')?.textContent || '').trim();
|
|
91
|
+
return {
|
|
92
|
+
tag_name: el.tagName.toLowerCase(), input_type: (el.type || '').toLowerCase(),
|
|
93
|
+
label: ((el.type === 'file' && groupLabel ? groupLabel : '') ||
|
|
94
|
+
(el.labels ? [...el.labels].map(x => x.innerText).join(' ') : '') ||
|
|
95
|
+
el.getAttribute('aria-label') ||
|
|
96
|
+
(described ? document.getElementById(described)?.innerText : '') ||
|
|
97
|
+
el.placeholder || el.name || '').trim()
|
|
98
|
+
};
|
|
99
|
+
}""",
|
|
100
|
+
timeout=timeout_ms,
|
|
101
|
+
)
|
|
102
|
+
for key in ("tag_name", "input_type", "label"):
|
|
103
|
+
if " ".join(actual[key].split()) != " ".join(binding[key].split()):
|
|
104
|
+
if (
|
|
105
|
+
key == "label"
|
|
106
|
+
and binding["input_type"] == "file"
|
|
107
|
+
and (binding.get("dom_id") or binding.get("dom_name"))
|
|
108
|
+
and re.search(r"resume|\bcv\b|cover letter", binding["label"], re.IGNORECASE)
|
|
109
|
+
and re.fullmatch(
|
|
110
|
+
r"attach|upload|replace|choose file", actual["label"], re.IGNORECASE
|
|
111
|
+
)
|
|
112
|
+
):
|
|
113
|
+
# Native identity and file type were already proved. Greenhouse
|
|
114
|
+
# may replace a document label with a generic upload action.
|
|
115
|
+
continue
|
|
116
|
+
raise FieldBindingError(
|
|
117
|
+
f"inspected field identity changed: {binding['field_id']} ({key})"
|
|
118
|
+
)
|
|
119
|
+
return locator
|