ContributionsMost RecentMost LikesSolutionsRe: How to launch web browser from python script any other solution to use this? or any other way in python scripting to launch the browser and authenticate the screen? import webbrowser import requests webbrowser.open_new(url) response = requests.get(url, auth=(username, password)) Here, I am able to open the web browser but unable to authenticate the browser popup screen. How to launch web browser from python script Hi Guys I want to launch a web-browser from python script test with a particular URL and then perform the authentication with username and password. Can anyone help to execute this task? I tried using Browsers.Item[btChrome].Run() but encountered with an error saying that "unable to use browser object. The web testing plugin that implements the object code is not installed." Re: How to launch web browser from python script No. I have only desktop testing licenced Re: How to identify scramble (not readable) text in text file using Python I would like to check for .cdx file which is a binary file type. It has to open in Notepad, MS Word or WordPad and check if it contains the scrambled texts. How to identify scramble (not readable) text in text file using Python I need to perform a test case where a text file required to open in Notepad, MS Word or WordPad and to check if it contains teh scrambled texts. Would be great if anyone come up with their suggestions. How to add a node under the child element in XML -<test-results total="13" time="0:16:30:27" date="5/22/2018"> -<test-suite total="13" not-run="0" name="TestCase"> -<results> -<test-suite total="13" not-run="0" name=""> <results/> </test-suite> </results> </test-suite> -<statistic> <stat name="tests" value="0"/> <stat name="failures" value="0"/> <stat name="errors" value="0"/> </statistic> </test-results> Hi, I want to add a node under the second <results/> element. I tried with following line of code but it is adding the new node under each "result" element. for result in root.iter("result"): ET.SubElement(result, 'Name').text = 'Hello' Can anyone suggest the solution in Python? Error '<' not supported between instances of 'int' and 'IDispatch Wrapper AnyUsageStub' def verify_csv_parameters(csvFile=None): """ Validate the csv parameters of specified file or saved file with ui nrt parameters """ global nrtDict nrtDict = dict() ignoredlist = [] greyOutValuesList = [] global csvFileDict csvFileDict = dict() bResult = False failureCount = 0 try: # Read from Testconfiguration.ini file. config = test_configuration.getTestConfiguration() global implantType implantType = config.getImplantType() fileHandler = file_manager.geFileHandler() if not csvFile: nrtfilePath = fileHandler.getNrtFilePath() else: nrtfilePath = os.path.join(supported_functions.getExportedFileFolderPath(), csvFile) global_objects.mainForm = global_objects.custom_Sound_EP.FormMain global_objects.mainForm.applicationPanels.PanelNRTProgramDetails.panelWorkarea.tabControl.ClickTab("Explorer View") grid = global_objects.mainForm.applicationPanels.PanelNRTProgramDetails.panelWorkarea.tabControl.tabPageExplorerView.panelExplorerView.dataGridNeuralResponses rowIndex = 0 while rowIndex < grid.DataSource.Count: dataGridRows = grid.dataGridRows_2 dataGridRows.OleValue[rowIndex].Selected = True dataGridRows.OleValue[grid.CurrentRowIndex].Selected = False grid.CurrentRowIndex = rowIndex grid.Select_3(rowIndex) bounds = grid.Bounds grid.Click(bounds.Left + bounds.Width / 2, bounds.Top + bounds.Height / 2) global_objects.custom_Sound_EP.FormMain.applicationPanels.PanelNRTProgramDetails.BarDockControl.DockedBarControl.ClickItem("Edit") nrtDict, greyOutValuesList = NRTParameters() for key,val in nrtDict.items(): Log.Message('GUI==>{0} = {1}' .format(key,val)) nrtFileName = os.path.basename(nrtfilePath) Log.Message('Validating CSV File ' + nrtFileName) csvFileDict = populateCSVParameters(rowIndex, nrtfilePath) ignoredlist = ignoredParameterList() #Log.Message(len(ignoredlist)) if "Acoustic" in nrtFileName: result = validateCSVParameters_Acoustic() failureCount += 1 if result is False else 0 for csvkey, csvval in csvFileDict.items(): mappedCSVKey = getMappedCsvKey(csvkey) mappedCSVValue = removeUnits(getMappedCsvValue(csvval)) if mappedCSVKey == constants.NRT_NR_SAMPLES: mappedCSVValue = getConvertedNrOfSamples(mappedCSVValue) if mappedCSVKey == constants.NRT_DELAY and mappedCSVKey in nrtDict: if StrToInt(mappedCSVValue) - 10 <= StrToInt(nrtDict[mappedCSVKey]) or StrToInt(nrtDict[mappedCSVKey]) <= StrToInt(mappedCSVValue) + 10: Log.Message('Ok {0} = {1}'.format(mappedCSVKey, mappedCSVValue)) else: Log.Message('Not Ok {0} = {1}'.format(mappedCSVKey, mappedCSVValue)) else: if mappedCSVKey in nrtDict and mappedCSVValue == nrtDict[mappedCSVKey]: Log.Message('Ok {0} = {1}'.format(mappedCSVKey, mappedCSVValue)) elif mappedCSVKey in ignoredlist or mappedCSVKey in greyOutValuesList: continue else: Log.Message('Not Ok {0} = {1}'.format(mappedCSVKey, mappedCSVValue)) failureCount += 1 rowIndex += 1 bResult = False if failureCount > 0 else True except Exception as e: Log.Error(__name__ + " error!! " + str(e)) bResult = False finally: return bResult Getting an error '<' not supported between instances of 'int' and 'IDispatch Wrapper AnyUsageStub'. I am unable to understand the error. Any anyone help on this? Re: Exception error is not printing Yes. I checked by debugging the code. Exception error is not printing def verify_saved_threshold_properties(fileName): bResult = False failureCount = 0 : try: : for i in range(0, aString.Length): str = aString.GetValue(i) for key, val in threshold_dict.items(): if str.contains(key): if str.contains(mapped_value): Log.Message(mapped_value + " value is present in saved setting dialog against {0} ".format(key)) break else: failureCount += 1 Log.Message(mapped_value + " value is not present in saved setting dialog against {0}".format(key)) else: continue bResult = False if failureCount > 0 else True else: : bResult = False except AttributeError as error: Log.Error(__name__ + " error!! " + str(error)) except Exception as error: Log.Error(__name__ + " error!! " + str(error)) bResult = True finally: return bResult Hi, All I am using a python script and trying to print exception error, but unfortunately, it is not printing. In the above code, an AttributeError exception is caught but the message is not logged. Can somebody please help? How to read content from the webpage (chrome) Hi, I am automating desktop application in which I want to print one of my application UI that opens in a chrome browser and have to get the webpage text that needs to copy in an excel file. I am able to launch excel file but not able to copy the webpage content. I was using Aliases.chrome.wndChrome_WidgetWin_14.Keys("^a^c") but for certian pages, wndChrome_WidgetWin_14 object is undefined. Please help me out how can I achieve this. Thanks in advance!