Launch Browser in Incognito/Private Mode
Thought of sharing the code in the community for launching browsers in their incognito modes. The function is parameterized such a way to run for the browsers Internet Explorer, Edge, Chrome and Firefox. Hope it will be useful for more people. function runIncognitoMode(browserName){ //var browserName = "firefox" //iexplore,edge,chrome,firefox if (Sys.WaitBrowser(browserName).Exists){ var browser = Sys.Browser(browserName); Log.Enabled = false // To disable the warning that might occur during closing of the browser browser.Close(); Log.Enabled = true // enabling the logs back } if(browserName=="edge"){ Browsers.Item(btEdge).RunOptions = "-inprivate" Delay(3000) Browsers.Item(btEdge).Run(); }else if (browserName=="iexplore"){ Browsers.Item(btIExplorer).RunOptions = "-private" Delay(3000) Browsers.Item(btIExplorer).Run(); }else if (browserName=="chrome"){ Browsers.Item(btChrome).RunOptions = "-incognito" Delay(3000) Browsers.Item(btChrome).Run(); }else if (browserName=="firefox"){ Browsers.Item(btFirefox).RunOptions = "-private" Delay(3000) Browsers.Item(btFirefox).Run(); } Sys.Browser(browserName).BrowserWindow(0).Maximize() }3.8KViews8likes3CommentsPassword Variable not passing the password
Trying to pass a secure password through the aqHttpRequest using the encrypted variable type of password. And it seems to pass a generic name in the logs when I try to access it. If I hard code the password it works fine. Trying to pass the password in aqHttpRequest["SetHeader"]("authorization", "Bearer " + Project["variables"]["AccessToken"]); In both the web logs and the test complete logs it shows {RandomNumbers}TestProject2AccessToken. If I useaqHttpRequest["SetHeader"]("authorization", "Bearer " + "ActualPassword"); it will work fine.Solved1.6KViews0likes3CommentsCustom “On Error Actions” by having a “Raise exception” option in the on error column
Attached as a PDF is my idea in a better format! In the project window there is a drop down under the column of On Error. This field determines what TestComplete does when it encounters an error. The option of this are Continue running, Stop test item, Stop project, or Inherit from project. I would like to add one option to this called Raise exception. This would allow users to do their own error handling by wrapping their entire test function associated with the test item in a try catch statement. One use case for this would be running a test multiple times with different data (ie: Account Number). When an error occurs we would like it to move onto the next account not continue executing with this same account so continue running will not work in this case. If we use stop test item we will not be able to execute the accounts after it. This is why there should be a 5th custom option that will let you handle it yourself. This is how a test case would be structured with multiple data points (ie: account numbers) if this feature existed: def MultipleDataPointTest(): accounts = ReadAccountsNumberDataBase(querry) for account in accounts: try: #Arrange testCaseAccountNumber = int(account[0]) Log.PushLogFolder(Log.CreateFolder("Test data: " + str(testCaseAccountNumber))) #Act TestStep1() TestStep2() TestStep3() #Assert confirmValue = getValue() if(not confirmValue): Log.Error("Test Failed") Log.Error("Test Passed") CloseOpenBrowsers() Log.PopLogFolder() except Exception as e: CloseOpenBrowsers() Log.Warning("The error was: " + str(e)) Log.Warning("Moving on to next account.") Log.PopLogFolder() continue This problem arises because Smart Bears has there own error handling and when there is an error in one of the TestComplete modules it is already handled. See code below for what kind of errors throw exception when test item on continue running: #generic function to call possible functions errors def Testing(): try: #replace with any below to see result Error2() except Exception as e: Log.Warning("The error was: " + str(e)) pass # generic python error # WILL raise exception def Error1(): Log.Message(badvar) Log.Message("Still going") # Click on Object that does not exist # will NOT raise exception def Error2(): Aliases.browser.Click() Log.Message("Still going") # Enter .Keys() on Object that does not exist # will NOT raise exception def Error3(): Aliases.browser.Keys('[Enter]') Log.Message("Still going") # Log.Error(string) # will NOT raise exception def Error4(): Log.Error("Bad thing") Log.Message("Still going") # Purposeful execution raising # WILL raise exception def Error5(): Log.Error("Bad thing") raise Exception Log.Message("Still going")1.5KViews3likes1CommentCompare text property of two objects
Hello, I am having a simple issue trying to compare two text values in keyword test where one value is greater than other. I had used compare property checkpoint, and the comparision is not correct.(you can see it from the printscreen). After that i had tried to do it in script, same with compare property checkpoint and the result was the same as in the keyword test. Also i had tried to do with if then statement:if (raspSr > vkIznos) then Log.message('ok') else log.error('notok') where i had defined my two variables as a String( var raspSr: string; var vkIznos: string), but it doesnt help. I constantlly get the incorrect results for everything mention above. I am sending you the printscreen results, any help will be welcomed.Solved1.7KViews0likes4CommentsHow do I wait for a user to perform an action?
In a Script test, how do I prompt the user to perform some action, then continue the script after the user indicates the action is complete? For example, I need to interact with a CAPTCHA on a form, so I need to tell the user to satisfy the CAPTCHA then click on something to continue the automated test.Solved3.7KViews0likes9CommentsCan't import files in Python
I'm simply trying to use an import statement to import some constants in a python test script and its not working. the file I'm trying to import is in my project and in the same directory as the file that's trying to import it.I've looked through the specifics of usage for Python and even copied the file into <TestComplete>\Bin\Extensions\Python\Python34\Lib folder but still nothing. The specifics of usage also says you can"changethe sys_path variable explicitly and then import the module" but Sys doesn't even have a "path" property.Solved2.3KViews0likes2CommentsImprove TestComplete performance
Hi, We want to improve the performance of TestComplete. By switching from TC11 to TC12, we improved by 25% the overall time of execution ofour test suite (from nearly 10h to 7h15). But since mid December, we have lost 1h. Does anyone already had a such issue with TestComplete 12 ? Losing performance without any change ? In our way to improve perfomance, we want to switch from JScript to Javascript. All of our script are in JScript, does switching to Javascript will increasethe performance ? Most of our tests are Keywords Tests. Is it possible that converting these Keywords Tests to Scripts will improve performance too ? Thanks for your help.1.3KViews0likes1CommentTo get the object where Object Checkpoint was called from during OnLogCheckPoint Event?
I am currently working on detecting the test information automatically during the test run in test complete. So my requirement is this. I have a test created in testcomplete I attach the OnLogCheckpoint event having my own code. There I can get checkpoint properties for object checkpoints (they are available in the LogParams) Yet I could not find a way to get on which object the object checkpoint was called. Is there any way to get this object/alias on which the object checkpoint is executed from the script from the OnLogCheckpoint event or some other way. Thanks in advance for any suggestions500Views0likes0CommentsCalling Function in Specific Script File
I have a function with the same name in multiple script files. How do I specifically designate the intendedscript file? Intellisense doesn't show all script files. Must the function names be unique across all script files? I assumed each file would have it's own scope.Solved1.7KViews0likes4Comments