Chuyển tới nội dung chính

VEVO (visa)

Project: Ezy.Module.Selenium.Search.Share File chính: Selenium/VevoSelenium.cs (Selenium ChromeDriver thuần)

Tra cứu trạng thái visa qua VEVO (Visa Entitlement Verification Online) và tải PDF kết quả. Module này nằm trong Share (không phải project riêng), được gọi bởi engine TextSearch_SeleniumEngine.

Nguồn

  • Site: online.immi.gov.au.

Input (hai tầng)

Hàng đợi TextSearch_SeleniumQueue (engine lọc !IsRunSeleniumType == "TextSearch_Vevo"): dùng ItemId, PDFs (JSON mảng path, lấy path đầu), FolderPath; set lại DataId, IsRun.

Bản ghi gốc TextSearch_Vevo (repo.GetById(item.ItemId)):

CộtVai trò
DocumentNumberSố hộ chiếu/giấy tờ
FamilyName / GivenNameHọ / tên
DOBNgày sinh
CountryOfDocumentQuốc gia cấp giấy tờ (SelectByValue)
TextSearch_DataLiên kết bản ghi data

DocumentType cố định "01" (passport) trong code, không lấy từ DB.

Login / Captcha

  • Có login (Login()): điền #username, #password, click name=login, rồi name=continue nếu có.
  • Credential từ file: Configs/VevoSearch.json → class VevoSeleniumSettingModel (Username/Password).
  • Không xử lý captcha.

Các bước scrape (SearchItem)

  1. OpenChrome: ChromeDriver, --no-sandbox, set download.default_directory = thư mục PDF cạnh app; kill chromedriver mồ côi nếu lỗi.
  2. Login(setting).
  3. Click clear #_1a0a-body.
  4. Chọn DocumentType: SelectByValue("01") (re-fetch sau reload).
  5. Điền: DocumentNumber, FamilyName, GivenName (nếu có), DOB, SelectByValue(CountryOfDocument), tick checkbox điều khoản.
  6. Submit form.
  7. Click download; so sánh file mới trong thư mục download (before/after); File.Copy sang filePath, xoá file tạm.
  8. Bóc text kết quả qua GetHtmlText(id) (.wc-input): FamilyName, GivenName, DocumentNumber, VisaClass_Subclass, VisaApplicant, Location, VisaType.
  9. CloseChrome.

Output

Entity TextSearch_Data_Vevo. Upsert: nếu TextSearch_Vevo.TextSearch_Data parse ra Id>0 thì update, ngược lại Insert. Key fields: PdfURLs (JSON, đã strip FolderPath), FamilyName, GivenName, DocumentNumber, VisaClass_Subclass, VisaApplicant, Location, VisaType. Output chính là PDF (không screenshot trong flow này).

Lỗi / edge cases

:::warning Nuốt exception Toàn bộ SearchItem bọc try/catch rỗng → lỗi bị nuốt, trả null (không ghi SearchStatus/log ở đây). Đây là điểm yếu đáng lưu ý. :::

  • Download button null → bỏ qua, không lưu data.
  • File tải không tồn tại → bỏ qua ghi DB.
  • OpenChrome lỗi → KillOrphanedChromeDriverProcesses; CloseChrome catch rỗng.
  • ChromeIsOpened/DriveIsRunning kiểm tra driver còn sống trước khi thao tác.

Trạng thái: active.