I have included code in this discussion prior to v7.0.8 of Ui.Vision allowed utilizing multiple if statements within one statement. First I will explain the logic of my scenario then if I can get some feedback that would be awesome.
The following fields are being scrubbed from my CRM software prior to being entered in on a third party site as seen in this image Screenshot by Lightshot
LOGIC:
First, we store the text “By Address or By General Area” and save it as the following value of {Fine_Tune_Search}
If {Fine_Tune_Search} includes the following text: “Address” then the next steps take place.
ERROR (Since most recent update of ui.vision I now receive the following error “Error in condition of if_v2: undefined is not a function”)
Next, as seen in the above image or here Screenshot by Lightshot you can see that the “Address Field” is missing. Because the field is missing the code skips the next line and instead goes to the label named “AddressUpdate” and throws a prompt for me to enter the address that then saves the address as the missing field value as above called “ADDRESS_Ideal_Location”
Next, as seen in the above image or here Screenshot by Lightshot you can see that the “City Field” is present. Because this field is present the code then proceeds forward and the first command is “gotoLabel” that skips 2 lines of code that would have prompted me to enter the data if it was missing as it was for the address field above.
I then run the same code for finding the Zip Code, Radius in Miles, prior to the ELSE, END statements.
My questions for you all are the following:
- Why am I now getting the following error “Error in condition of if_v2: undefined is not a function?” I tried the following solution:
However, I receive the following error with this solution when I try including the value ${Fine_Tune_Search} within the code:
- [error]
Line 27: Error in executeScript code: Refused to evaluate a string as JavaScript because ‘unsafe-eval’ is not an allowed source of script in the following Content Security Policy directive:
- I was wondering if this is the best way to accomplish what I wanted to accomplish and if no what is a better solution as I was confused by an article a read regarding Sandbox scripts?
,
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"app-container\"]/div/div/div[2]/div/div/div/div/div/div[3]/div[3]/div/div/div/div/form[15]/div/div",
"Value": "Fine_Tune_Search",
"Description": ""
},
{
"Command": "if_v2",
"Target": "${Fine_Tune_Search}.includes("Address") == true",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "2",
"Value": "!Timeout_wait",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"app-container\"]/div/div/div[2]/div/div/div/div/div/div[3]/div[3]/div/div/div/div/form[16]/div/div",
"Value": "ADDRESS_Ideal_Location",
"Description": ""
},
{
"Command": "gotoIf_v2",
"Target": "${!lastCommandOK} == false",
"Value": "AddressUpdate",
"Description": ""
},
{
"Command": "gotoLabel",
"Target": "NEXT #1",
"Value": "",
"Description": ""
},
{
"Command": "label",
"Target": "AddressUpdate",
"Value": "",
"Description": ""
},
{
"Command": "prompt",
"Target": "Provide ONLY The Street Address!",
"Value": "ADDRESS_Ideal_Location",
"Description": ""
},
{
"Command": "label",
"Target": "NEXT #1",
"Value": "",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"app-container\"]/div/div/div[2]/div/div/div/div/div/div[3]/div[3]/div/div/div/div/form[17]/div/div",
"Value": "CITY_Ideal_Location",
"Description": ""
},
{
"Command": "gotoIf_v2",
"Target": "${!lastCommandOK} == false",
"Value": "CityUpdate",
"Description": ""
},
{
"Command": "gotoLabel",
"Target": "NEXT #2",
"Value": "",
"Description": ""
},
{
"Command": "label",
"Target": "CityUpdate",
"Value": "",
"Description": ""
},
{
"Command": "prompt",
"Target": "Provide City Name",
"Value": "CITY_Ideal_Location",
"Description": ""
},
{
"Command": "label",
"Target": "NEXT #2",
"Value": "",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"app-container\"]/div/div/div[2]/div/div/div/div/div/div[3]/div[3]/div/div/div/div/form[19]/div/div",
"Value": "ZIP_CODE_Ideal_Location",
"Description": ""
},
{
"Command": "gotoIf_v2",
"Target": "${!lastCommandOK} == false",
"Value": "ZipUpdate",
"Description": "${ZIP_CODE_Ideal_Location} == (\"#LNF\") ${!statusOK} == false"
},
{
"Command": "gotoLabel",
"Target": "NEXT #3",
"Value": "",
"Description": ""
},
{
"Command": "label",
"Target": "ZipUpdate",
"Value": "",
"Description": ""
},
{
"Command": "prompt",
"Target": "Provide Zip Code",
"Value": "ZIP_CODE_Ideal_Location",
"Description": ""
},
{
"Command": "label",
"Target": "NEXT #3",
"Value": "",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"app-container\"]/div/div/div[2]/div/div/div/div/div/div[3]/div[3]/div/div/div/div/form[20]/div/div",
"Value": "Radius_In_Miles",
"Description": ""
},
{
"Command": "else",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "0",
"Value": "Radius_In_Miles",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
},```