fix FMCSA form: wait for lvl2 dropdown, update selectors
This commit is contained in:
parent
99a53ad970
commit
4a4bbd048e
1 changed files with 20 additions and 1 deletions
|
|
@ -131,9 +131,28 @@ async def submit_mcs150(
|
|||
|
||||
# Inquiry Type — select "USDOT Number" (value=175)
|
||||
await page.select_option(
|
||||
"#rn_ProductCategoryInputSimpleFiltered_20_Incident\\.Product_lvl1",
|
||||
'select[name="Incident.Product_lvl1"]',
|
||||
value="175", timeout=5000,
|
||||
)
|
||||
await page.wait_for_timeout(2000)
|
||||
|
||||
# Sub-category — "Change/update my USDOT company information" (value=226)
|
||||
# Wait for the lvl2 dropdown to appear after lvl1 selection
|
||||
try:
|
||||
await page.wait_for_selector(
|
||||
'select[name="Incident.Product_lvl2"]', state="visible", timeout=5000,
|
||||
)
|
||||
await page.select_option(
|
||||
'select[name="Incident.Product_lvl2"]',
|
||||
value="226", timeout=5000,
|
||||
)
|
||||
except Exception:
|
||||
# Fallback: try by partial ID match
|
||||
lvl2 = await page.query_selector('select[id*="Product_lvl2"]')
|
||||
if lvl2:
|
||||
await lvl2.select_option(value="226")
|
||||
else:
|
||||
LOG.warning("[fmcsa] Could not find/select lvl2 dropdown")
|
||||
await page.wait_for_timeout(1000)
|
||||
|
||||
# Question text
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue