how to read and compare a part of output string with a stored variable in seleniumIDE - selenium-ide

98619664xxxx1::01070:0001:SKIP:0 X
is my output that I see in browser, from the xpath=//pre[contains(.,'98619664xxxx1::01070:0001:SKIP:0 X')] and I want to extract only 619664xxxx1 from the output string and verify this with a variable I have set in the test suite of the project.
I have tried the storeText of the output to a variable and then with if condition trying to read the text with my variable.
A part of the log:-
assertElementPresent on xpath=//pre[contains(.,'98619664xxxx1::01070:0001:SKIP:0 X')] OK
20.storeText on xpath=//pre[contains(.,'98619664xxxx1::01070:0001:SKIP:0 X')] with value response OK
if on "${response}" == "${Rufnummer1}" Failed:
missing ) in parenthetical

Related

Unable to pass dynamic and unique date values in JMeter

I have a request payload(JSON format) which has an array with 1000 objects and each object has 6 key value pairs out of which 5 I’m reading from the csv file using parameterization and the 6th key has to be a unique date value of a future date for each of the object in the array.
I tried this with time-shift function which works for 1 iteration but I want to execute it for n- number of iterations.
I checked for groovy code for this but I have no knowledge of groovy and have started learning it.
How can I achieve this in JMeter.
Also, on reading time-shift function from HTTP Request Defaults-Parameters or from the Test Plan-User Defined Variables it does not read different date for each object, it duplicates same date of the first variable in each object.
{
“deviceNumber": “XX”,
“array: [
{
“keyValue1: “${value1_ReadFromCSV}”,
"keyValue2”: “${value2_ReadFromCSV}”,
"keyValue3”: “${value3_ReadFromCSV}”,
"keyValue4”: “${value4_ReadFromCSV}”,
"keyValue5”: “${value5_ReadFromCSV}”,
"keyValue6”: "2020-05-23” (Should be dynamically generated)
},
{
“keyValue7: “value7_ReadFromCSV”,
"keyValue8”: "value8_ReadFromCSV",
"keyValue9”: "value9_ReadFromCSV",
"keyValue10”: "value10_ReadFromCSV",
"keyValue11”: "value11_ReadFromCSV",
"keyValue12”: "2020-05-24” (Should be dynamically generated)
},
.
.
.
.
{
“keyValue995: “value995_ReadFromCSV”,
"keyValue996”: "value996_ReadFromCSV",
"keyValue997”: "value997_ReadFromCSV",
"keyValue998”: "value998_ReadFromCSV",
"keyValue999”: "value999_ReadFromCSV",
"keyValue1000”: "2025–12-31” (Should be dynamically generated)
}
]
}
I have got the partial solution to this, by reading the csv file line by line and storing each line into a variable using groovy. However, I don't want to store directly the line into the variable but to create a JSON object like above from each line of csv file with a unique future date for each object which is in the array.
The csv file is : (Note: I have removed column for date column in csv as I no longer need it.)
deviceNumber,keyValue1,keyValue2,keyValue3,keyValue4,keyValue5,keyValue7,keyValue8,keyValue9,keyValue10,keyValue11,keyValue12,keyValue13,keyValue15,keyValue15,keyValue16
01,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring
02,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring
03,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring
.
.
.
1000,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring,somestring
Kindly suggest any reference/example to do this.
I provide only generic instructions:
You can dynamically construct request body using JSR223 PreProcessor
You can read CSV file into memory using File.readLines() function
You can build JSON out of the values from the CSV file using JsonBuilder class
More information:
Apache Groovy - Parsing and producing JSON
Apache Groovy - Why and How You Should Use It

How to concatenate project SOAPUI variables in a test Request?

I have defined test suite properties as msisdn and imsi. Is there any way that both the variables are substituted for their values. I can get only the last variable to be substituted.
${properties#imsi}${#properties#msisdn}
Only value for msisdn gets replaced

Insert image encoded in base 64 in a word document with python-docx?

I use python-docx to generate word document. the user want that he create a template(in a field description) and when he write for example %(company_logo)s in the template, I replace this expression by the picture of the company that I recupered from the database.
as a first issue, I recupered the logo of a company from the database(Postgresql) and I use this code to replace this expression:
cr.execute("select name, logo_web from res_company where id=%s",[soc_id])
r=cr.fetchone()
if r :
company_name=r[0]
logo_company = r[1]
output = cStringIO.StringIO()
doc = docx.Document()
contenu=contenu % {'company_logo': logo_company, 'company_name': company_name,}
doc.add_paragraph(contenu)
The output was a document word that contains the base 64 code of the image as a string. I decoded this code and I tried to add it as a picture with the following code:
logo_company = base64.b64decode(r[1])
doc.add_picture(logo_company)
But I have this error that tells to me that argument must be the path to the picture.
TypeError: file() argument 1 must be encoded string without NULL bytes, not str
The documentation here explains that the add_picture() method takes a file as an argument. The file can be in the form of a path, or it can be a file-like object, such as an open file or a StringIO object. It cannot accept a bytestring containing the bytes of the image, which is what you've tried to do.
So you'll need to convert the image bytes into a file-like object, perhaps using StringIO(), and hand the resulting file-like object to add_picture(). That will get it working for you. Something like:
logo_file = StringIO(base64.b64decode(r[1]))
doc.add_picture(logo_file)

Matlab not recognizing string variable

I have a variable that is holding a string (the string contains a path to a .mat file). However whenever I call load the variable I get an error saying "Error using load Unable to read file"
Here is my code where I call load:
fName = strcat(fName,'_features.mat');
display(fName);
load(fName);
For those curious fName = '/Users/MATLAB/10360453085_p2_features.mat'
Why am getting an error on load even though when I copy the value of fName into load it works perfectly fine, but using load(fName) gives me an error?
Most likely, fname is initialized somewhere as a cell array. strcat will therefore return a cell array, so that disp will display it as 'name' rather than name.
load(fName{1})
or
load(char(fName))
will work in this case.

datastage buildop error - buildop throwing the error

I am getting the following error message, when I am running a job in datastage. The buildop stage is throwing this error
isUsable() is false on the accessor interfacing to field "getEditsReturn"
The filed is input field.
getEditsReturn is the only input column to buildop.
The code is
while(!inputDone(0)){
readRecord(0);
input = inputData.getEditsReturn;
fprintf(fp,"input : %s",input.c_str());
//break the string based on delimiter and assign to output columns
transferAndWriteRecord(0);
}
Here input is the c++ string type(not char[]). I tried to assign the input column to char[] also. It was also not working. I have set autoread and autowrite to false. I am writing those output columns to a file using fprintf. I am getting that output correctly in the file. But the stage is failing