tday
June 3, 2019, 8:35pm
1
{
"Command": "if",
"Target": "window.document.getElementById('core_person_address_address1').value.split(' ')[0].toUpperCase()==='PO';",
"Value": ""
},
This command was previously working, but now returns: Error in condition of if: Cannot read property ‘value’ of null
If I convert it to a v2 if, the same error is returned. I’m wondering how to deal with this?
admin
June 3, 2019, 9:13pm
2
Hmm… we did not change anything with storeEval and if
in V5.0.
=> I tested in the old V4.2.6 and get the same error. Maybe something on the website changed?
tday
June 3, 2019, 9:56pm
3
I tested that the id still exists. The code works in the browser console, but consistently throws when running the macro with v5. What do you mean you tested in v4.2.6 and get the same error?
admin
June 3, 2019, 9:57pm
4
The code works in the browser console
But did it work in the old Kantu? If you can send me a test URL, I can test it here as well.
tday
June 3, 2019, 9:59pm
5
Yes, it worked earlier today, then the update happened and I tried to run the code, and no bueno.
tday
June 3, 2019, 10:19pm
6
If I break the original command into two commands, it works:
{
"Command": "storeEval",
"Target": "window.document.getElementById('core_person_address_address1').value.split(' ')[0].toUpperCase();",
"Value": "TEST"
},
{
"Command": "if",
"Target": "${TEST}==='PO';",
"Value": ""
},
admin
June 4, 2019, 9:53am
7
I am glad you found a solution. The same will work with executeScript:
{
"Name": "getvalue",
"CreationDate": "2019-6-4",
"Commands": [
{
"Command": "open",
"Target": "https://ui.vision/demo/executescript",
"Value": ""
},
{
"Command": "type",
"Target": "id=sometext",
"Value": "hello world"
},
{
"Command": "storeEval",
"Target": "window.document.getElementById('sometext').value.split(' ')[0].toUpperCase();",
"Value": "t1"
},
{
"Command": "echo",
"Target": "${t1}",
"Value": ""
},
{
"Command": "executeScript",
"Target": "return window.document.getElementById('sometext').value.split(' ')[0].toUpperCase();",
"Value": "t2"
},
{
"Command": "echo",
"Target": "${t2}",
"Value": ""
}
]
}
tday
June 4, 2019, 5:58pm
8
Typically, the if statement is false and the workaround works. However, today the macro encountered a true situation and it creates an error: (also, converting the workaround code to an if_v2 does not create the error, there does seem to be some kind of regression with if_deprecated)
background_csv_editor_desktop_screenshot_editor_popup_vision_editor.js:138 2019-06-04T17:53:32.334Z - command index: 13, Error: Error in condition of if: PO is not defined
prev. @ background_csv_editor_desktop_screenshot_editor_popup_vision_editor.js:138
(anonymous) @ popup.js:6974
emit @ vendor.js:128422
__errLog @ popup.js:22262
(anonymous) @ popup.js:22153
(anonymous) @ popup.js:22030
Promise.catch (async)
(anonymous) @ popup.js:22152
Promise.then (async)
__go @ popup.js:22052
(anonymous) @ popup.js:22150
Promise.then (async)
(anonymous) @ popup.js:22146
(anonymous) @ popup.js:22030
Promise.then (async)
(anonymous) @ popup.js:22122
Promise.then (async)
__go @ popup.js:22052
(anonymous) @ popup.js:22150
Promise.then (async)
(anonymous) @ popup.js:22146
(anonymous) @ popup.js:22030
Promise.then (async)
(anonymous) @ popup.js:22122
Promise.then (async)
__go @ popup.js:22052
(anonymous) @ popup.js:22150
Promise.then (async)
(anonymous) @ popup.js:22146
(anonymous) @ popup.js:22030
Promise.then (async)
(anonymous) @ popup.js:22122
Promise.then (async)
__go @ popup.js:22052
(anonymous) @ popup.js:22150
Promise.then (async)
(anonymous) @ popup.js:22146
(anonymous) @ popup.js:22030
Promise.then (async)
(anonymous) @ popup.js:22122
Promise.then (async)
__go @ popup.js:22052
(anonymous) @ popup.js:22150
Promise.then (async)
(anonymous) @ popup.js:22146
(anonymous) @ popup.js:22030
Promise.then (async)
(anonymous) @ popup.js:22122
Promise.then (async)
__go @ popup.js:22052
(anonymous) @ popup.js:22150
Promise.then (async)
(anonymous) @ popup.js:22146
(anonymous) @ popup.js:22030
Promise.then (async)
(anonymous) @ popup.js:22122
Promise.then (async)
__go @ popup.js:22052
(anonymous) @ popup.js:22150
Promise.then (async)
(anonymous) @ popup.js:22146
(anonymous) @ popup.js:22030
Promise.then (async)
(anonymous) @ popup.js:22122
Promise.then (async)
__go @ popup.js:22052
(anonymous) @ popup.js:22150
Promise.then (async)
(anonymous) @ popup.js:22146
(anonymous) @ popup.js:22030
Promise.then (async)
(anonymous) @ popup.js:22122
Promise.then (async)
__go @ popup.js:22052
(anonymous) @ popup.js:22150
Promise.then (async)
(anonymous) @ popup.js:22146
(anonymous) @ popup.js:22030
Promise.then (async)
(anonymous) @ popup.js:22122
Promise.then (async)
__go @ popup.js:22052
(anonymous) @ popup.js:22150
Promise.then (async)
(anonymous) @ popup.js:22146
(anonymous) @ popup.js:22030
Promise.then (async)
(anonymous) @ popup.js:22122
Promise.then (async)
__go @ popup.js:22052
(anonymous) @ popup.js:22150
popup.js:22028 Uncaught (in promise) Error: token expired
at popup.js:22028
(anonymous) @ popup.js:22028
popup.js:22219 Uncaught (in promise) Error: Stop reason: ERROR
at popup.js:22219
admin
June 4, 2019, 9:23pm
9
1 Like