Inject Js Script 처리시 Error HRESULT E_FAIL has been returned from a call to a COM component

Inject Js Script 처리시 아래와 같은 오류가 납니다.
혹시 원인 아시는분 도움부탁드려요~
** scriptCode
“document.querySelector('#projectAdminForm > div.tabs_pro_a_tag > ul > li:nth-child(” + i.ToString() + “) > a’).innerText”

**오류메시지
19.6.0+Branch.master.Sha.adf20656f41da84cdec5e5620b62276717eb7319

Source: Inject Js Script

Message: Error HRESULT E_FAIL has been returned from a call to a COM component.

Exception Type: UiPath.Core.ElementOperationException

RemoteException wrapping UiPath.Core.ElementOperationException: Error HRESULT E_FAIL has been returned from a call to a COM component. —> RemoteException wrapping System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
at UiPath.UiNodeClass.InjectAndRunJS(String bstrCode, String bstrInputText)
at UiPath.Core.UiElement.InjectAndRunJS(String code, String input)
— End of inner exception stack trace —
at UiPath.Core.Activities.ScopeActivity.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

오류 발생하는 sample xaml file 올려주시면 다른 개발자 분들이 도움 드리는데 용이할 것 같습니다.

1 Like

늦었지만 간단히 답변을 드리면 inject js 액티비티에서는 반드시 아래의 형식을 따라야 합니다.
function(element, paramas){
script
}
여기서 element는 인식한 UiElement이고 params는 input 파라미터로 넘긴 값입니다.
그리고 지정한 UiElement 범위내에서 해당 function이 실행되기 때문에 UiElement를 처리 하기 위한
요소가 포함된 범위를 잡아주어야 합니다.
참고하세요.

COM 구성 요소에 대한 호출에서 오류 HRESULT E_FAIL이 반환되었습니다 해당 에러메세지의 경우 엑셀 자동화를 위해 엑셀에 접근해야 하는데 불가능할때 발생하는 에러입니다 혹시 공유 디렉토리에 올려져 있어 다른 계정이 점유하고 있는지 확인해보시면 좋을꺼같네요