Forum Discussion
Thank you both for your responses. I did the research into the aqDateTime object and its formatting options. I created this sample of python unit script code but I must be missing something because the interpreter will not let me execute. What could I be missing? Yes, I checked the examples.
def ConcatLastNameWithTime():
Str1 = "Aliases.browser.pageApplyNow6.formWouldYouLikeToIncludeA.textboxLastName"
Str2 = "aqConvert.DateTimeToFormatStr(aqDateTime.Now(), "%Y%m%d%H%M%S"))
Log.Message(aqString.Concat(Str1, "Str2"))
# Log.Message(Aliases.browser.pageApplyNow6.formWouldYouLikeToIncludeA.textboxLastName + aqConvert.DateTimeToFormatStr(aqDateTime.Now(), "%Y%m%d%H%M%S"))
then yes I need it in a variable project wide. How would I get the above to run in the interpreter correctly and then how do I make it into a variable? Could I make my variable point to Unit1?
Or MarshaR would this be simpler somehow to deploy?
Sincerely,
Todd
- todd22 years agoContributor
So I went ahead and built three steps into my keyword test script
The Unit2 script runs by itself just fine but when it executes within the entire keyword script it gives me an exception. Why? My thought was I have the time format working well. I can place the lastname in a variable project wide now and I initialized it with a starter value just fine by setting the default value. All I want to do is run the code snippet Project.Variables.LastName + Unit2 Can't that be done?
Sincerely,
Todd2
- todd22 years agoContributor
Works great! Now I just need to add that last name that is in the Variable for the project at the moment the script runs to the front of this output as one big string and we are good to go. What could I be missing?
Thanks,
Todd2
- todd22 years agoContributor
Team: This code now works as a Unit script
from datetime import datetime
def ContatenationString():
Lastname = "America"
now = datetime.now()
current_time = now.strftime("%H%M%S")
UpdatedLastname = Lastname+current_time
Log.Message(UpdatedLastname)
ContatenationString()
But when the keyword test script executes and the lastname on the form approaches, the name America prints but not UpdatedLastname. What do we got to do to make the lastname text box print the UpdatedLastname value? The keyword test steps have been modified as well as indicated below.
Thank you,
Todd2
Related Content
- 13 years ago
Recent Discussions
- 3 hours ago
- 7 hours ago