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.7KViews7likes3CommentsCrossbrowser Object mapping: Object correctly detected in one browser not detected in the second
Hi all, just a post about something I've noticed when working with mapped object between Firefox and Chrome. I was having issues getting some mapped objects to be detected in the second browser having mapped successfully in the first. In all cases I was using some text property, e.e. innerText, to identify the object and there appeared to be no difference in the text property between the two browsers, when I examinded using object spy etc., and hence no obvious reason why the mapped object could not be found by testcomplete in the second browser What I have discovered after trial and error is that there appear to be unseen/invisible characters within the text property itself and that this is why testcomplete cannot identify the object in the second browser. Workaround I have found is to delete the extra invisible characters and also to wildcard the beginning and end of the text string. In namemapping editor select the object and open the edit object properties dialog, select the property and click the edit icon, object property edit dialog is presented. Click at the start of the string and use the "Delete" button on keyboard to remove any unseeen characters that may be occurring at the start of the string.(presence of unseen chars at start of a string is noticeable in that the cursor does not move even though the key has been pressed, until all unseen chars have been deleted at which point the string characters will then start to be deleted) Click at the end of the string to move the cursor and use both the Delete and Backspace keys to remove any potential unseen chars at the end of the string. (presence of unseen chars at end of a string is most noticeable when using Backspace, the cursor does not move even though the key has been pressed, until all unseen chars have been deleted at which point the text string characters will start to be deleted) e.g. I have a dialog with titie bar text Add task, which was not being detected by testcomplete in the second browser. I edited the innerText property value, performed the deletion and saved the changes. The dialog was then detected in the second browser. Ocassionally deletion of the unseen/invisible chars does not work and the object still cannot be found by testcomplete in the second browser. In these cases I also add wildcards to the beginning and end of the text string, after performing the deletion steps, and the mapped object is then correctly detected in the second broswer. For example: *Addtask* Hope this is of help to someone out there trying to figure out why your mapped objects are not being detected between different browsers. And if anyone can shed some light on what exactly is happening to create the unseen/invisible characters in the mapped object property I'd love to hear about it. Regards Tom.2.2KViews2likes3Comments