Contributions
Re: python error in datetime
It is known Python problem not related to TestComplete. https://bugs.python.org/issue27400 The workaround is to use alternate version of strptime. It is mentionned in documentation : Conversely, the datetime.strptime() class method creates a datetime object from a string representing a date and time and a corresponding format string. datetime.strptime(date_string, format) is equivalent to datetime(*(time.strptime(date_string, format)[0:6])). import datetime import time def myfun(): string_date = "2016-11-03" format = "%Y-%m-%d" try: res = datetime.datetime.strptime(string_date, format) except TypeError: res = datetime.datetime(*(time.strptime(string_date, format)[0:6])) Log.Message(res)8.5KViews6likes0CommentsNew TestComplete 12 Feature - JavaScript Support
Greetings TestComplete Users, In TestComplete 12, we have added support for a new script language – JavaScript (ECMAScript 6).Now, you can record, write, run and debug tests written in JavaScript.My Team worked hard to implement this feature. We hope you will like it! Please review a short video describing this feature. https://smartbear.wistia.com/medias/9hj8zs6xlo Have you already tried creating tests on JavaScript? How was it? You can find more TestComplete videos here: https://support.smartbear.com/testcomplete/videos/ To play with JavaScript, you can request the TestComplete 12 Trial: https://smartbear.com/product/testcomplete/overview/626Views1like0CommentsRe: Performance Counters
We don't support this right now.Could you please describe the feature request you want us to implement here? https://community.smartbear.com/t5/TestComplete-Feature-Requests/idb-p/TestXCompleteFeatureRequests Our Product Owner monitors this forum regularly. She reviews all submitted features and consider their implementation.667Views1like0CommentsRe: python script doesn't work when testcomplete launches from command line
Sample script: from subprocess import * def main(): p = Popen("notepad.exe", stdout=PIPE, shell=True) TestComplete is GUI app and does not have its own console. Omitting stdin and stderr parameters in Popen constructor cause errors in some cases, because code in Lib\subprocess.py tries to use console of current process (TestComplete.exe). Use not None stdin and stderr values. If it is suitable for you, it could be DEVNULL, PIPE, file... From Popen man: stdin, stdout and stderr specify the executed program’s standard input, standard output and standard error file handles, respectively. Valid values are PIPE, DEVNULL, an existing file descriptor (a positive integer), an existing file object, and None. PIPE indicates that a new pipe to the child should be created. DEVNULL indicates that the special file os.devnull will be used. With the default settings of None, no redirection will occur; the child’s file handles will be inherited from the parent. Additionally, stderr can be STDOUT, which indicates that the stderr data from the applications should be captured into the same file handle as for stdout. from subprocess import * def main(): p = Popen("notepad.exe", stdout=PIPE, stdin=PIPE, stderr=PIPE, shell=True)1.4KViews3likes1CommentRe: Call Windows Form function based on string
You can use getattr built-in function. def main(): obj = Sys.Process("notepad", 2).Window("Notepad", "Untitled - Notepad", 1).Window("Edit", "", 1) callClickMethod(obj, True, -1, -1) callClickMethod(obj, False, -1, -1) def callClickMethod(obj, dbl, x, y): getattr(obj, "DblClick" if dbl else "Click")(x, y)1.2KViews2likes0CommentsRe: OCR Recognition help
tbom, the following code recognizes your sample captcha in TestComplete 11.31: def test(): captcha = Sys.Browser("iexplore").Page("http://community.smartbear.com/nwkab66374/attachments/nwkab66374/Getting_Started_with_TestComplete/22087/1/captcha.png").Image("captcha_png") Log.Message(recognizeCaptcha(captcha)) def recognizeCaptcha(captcha): recognizer = OCR.CreateObject(captcha) options = recognizer.DefaultOptions options.GrayScaleBinarization = True return recognizer.GetText(options)1.8KViews1like0Comments