Sub DeleteItemInList(myid As String, myCode As String) As ResumableSub
wv.LoadUrl("https://xxxxxxxxxxx.gr/xxxform/xxxx/ListItems")
Wait For wv_PageFinished(URL As String)
Sleep(2000)
wait for(RunJavaScript($"deleteItem('${myid}','${myCode}');"$)) complete (result1 As String) 'here i am running javascript of webpage - that returns confirmation window
Sleep(2000)
Dim jsConfirm As String
jsConfirm = "(function() {" & _
" try {" & _
" var yesBtn = document.querySelector('button.boot-accept');" & _
" if (yesBtn) yesBtn.click();" & _
" return 'CONFIRMED';" & _
" } catch(e) {" & _
" return 'ERROR: ' + e.message;" & _
" }" & _
"})()"
Wait For(RunJavaScript(jsConfirm)) Complete (result2 As String) 'clicking "YES" at confirmation window
Return result2
End Sub