{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/vi/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Chạy JavaScript trên trang"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"chạy-javascript-trên-trang","__idx":0},"children":["Chạy JavaScript trên trang"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Loại nút ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["browser_injectJavaScript"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"chức-năng","__idx":1},"children":["Chức năng"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Chạy JavaScript trên trang khi hành động cần truy cập document của trình duyệt."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"cấu-hình-trong-ứng-dụng-máy-tính","__idx":2},"children":["Cấu hình trong ứng dụng máy tính"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/inject-java-script.9c689498b6dcffb8a7b14e78bafdda313c402532c0e264f664dff533253a499a.0538f3a9.webp","alt":"Cấu hình nút \"Chạy JavaScript trên trang\" trong ứng dụng máy tính"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Ảnh chụp từ giao diện tiếng Anh của MoreLogin Desktop V2.73.101."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"đầu-vào","__idx":3},"children":["Đầu vào"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Các trường này nằm trong ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.browserUi.inputs"]},"."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Trường"},"children":["Trường"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Kiểu hoặc giá trị"},"children":["Kiểu hoặc giá trị"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Bắt buộc theo schema"},"children":["Bắt buộc theo schema"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Giá trị mặc định khi thực thi"},"children":["Giá trị mặc định khi thực thi"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Mô tả và giới hạn"},"children":["Mô tả và giới hạn"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["params"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["object"]},">"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Không"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[]"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["params. Giá trị ban đầu trong trình chỉnh sửa: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[]"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["content"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Không"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["—"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Script cần chèn"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["outputFormat"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["object"]}," (hỗ trợ tham chiếu biến)"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Không"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{\"type\":\"object\"}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Định dạng đầu ra. Giá trị ban đầu trong trình chỉnh sửa: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{\"type\":\"object\"}"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["executionTimeoutMs"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["WorkflowNumber"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Không"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["3000"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Thời gian chờ thực thi (ms); tối thiểu sau khi phân giải: 100; tối đa sau khi phân giải: 30000. Giá trị ban đầu trong trình chỉnh sửa: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["3000"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"yêu-cầu-theo-chế-độ-và-giới-hạn","__idx":4},"children":["Yêu cầu theo chế độ và giới hạn"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Nút chỉ chấp nhận script được nhập trực tiếp. Hãy truyền giá trị một cách tường minh qua params. Tham số hằng kiểu object/array phải là đối tượng/mảng JSON hợp lệ (được xác thực khi ghi). Script chạy bất đồng bộ trên trang thực, với thời gian chờ thực thi 100–30000ms."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Mã lỗi xác thực: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RPA_NODE_INPUT_INVALID"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"tham-chiếu-đầu-vào","__idx":5},"children":["Tham chiếu đầu vào"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Trường"},"children":["Trường"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Dạng được phép"},"children":["Dạng được phép"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["params"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["literal"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["template"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["content"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["literal"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["template"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["outputFormat"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["literal"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["template"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["executionTimeoutMs"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["literal"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["numericExpression"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"đầu-ra","__idx":6},"children":["Đầu ra"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Trường đầu ra"},"children":["Trường đầu ra"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Kiểu hoặc giá trị"},"children":["Kiểu hoặc giá trị"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[\"null\",\"boolean\",\"number\",\"string\"]"]}," / array<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["JSON"]},"> / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["object"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["injected"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Tham chiếu các trường đã công bố dưới dạng ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["${nodeId.data.field}"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"ví-dụ-json","__idx":7},"children":["Ví dụ JSON"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Một đối tượng nút hoàn chỉnh để đặt vào mảng ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nodes"]}," của quy trình hoặc vào ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["blocks"]}," của một nút khác."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"id\": \"page_info\",\n  \"type\": \"browser_injectJavaScript\",\n  \"data\": {\n    \"title\": \"Read the title and link count from the page\",\n    \"browserAction\": \"injectJavaScript\",\n    \"browserUi\": {\n      \"inputs\": {\n        \"params\": [],\n        \"content\": \"return { title: document.title, links: document.links.length };\",\n        \"outputFormat\": {\n          \"type\": \"object\"\n        },\n        \"executionTimeoutMs\": 3000\n      },\n      \"exception\": {\n        \"timeout\": 30000,\n        \"policy\": \"interrupt\"\n      }\n    }\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/vi/browser-rpa/nodes"},"children":["Quay lại danh mục nút"]}]}]},"headings":[{"value":"Chạy JavaScript trên trang","id":"chạy-javascript-trên-trang","depth":1},{"value":"Chức năng","id":"chức-năng","depth":2},{"value":"Cấu hình trong ứng dụng máy tính","id":"cấu-hình-trong-ứng-dụng-máy-tính","depth":2},{"value":"Đầu vào","id":"đầu-vào","depth":2},{"value":"Yêu cầu theo chế độ và giới hạn","id":"yêu-cầu-theo-chế-độ-và-giới-hạn","depth":2},{"value":"Tham chiếu đầu vào","id":"tham-chiếu-đầu-vào","depth":2},{"value":"Đầu ra","id":"đầu-ra","depth":2},{"value":"Ví dụ JSON","id":"ví-dụ-json","depth":2}],"frontmatter":{"seo":{"title":"Chạy JavaScript trên trang"}},"lastModified":"2026-11-20T14:40:39.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/vi/browser-rpa/nodes/data/inject-java-script","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}