Setting a Value in SAPList - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others) +--- Thread: Setting a Value in SAPList (/Thread-Setting-a-Value-in-SAPList) |
Setting a Value in SAPList - nivdhi - 05-08-2013 Hello I am working on automating a WebDynpro application. I am trying to select a value from the SAPList. I have tried a few different approaches but nothing seems to be working. Any input about this would be appreciated. This SAPList is nested in a webtable and has the list options as WebElements. Here are the things I have tried; 1. Code: Set sObject = Browser("ABC").Page("ABC").Frame("ABC").SAPList("ABC").Object - In this case, I can see that the value is set in the SAPList, but when I do the action like Continue to go to the next page for which I made the selection, it doesn't take me to the page that it soudl take me to based on my selection. It instead takes me to whatever has been selected by default in the SAPList. 2. Code: intU = Postion of required option in SAPList 3. I have tried setting the default value to what I want to select, but that did not work either. Code: Browser("ABC").Page("ABC").Frame("ABC").SAPList("ABC").Object.defaultvalue="strValToSet" Thanks Niv RE: Setting a Value in SAPList - basanth27 - 05-09-2013 I have never worked on a SAP based application, but, would it work if once you set the value you click on the page and then say continue? RE: Setting a Value in SAPList - nivdhi - 05-09-2013 Hi Basanth Thanks for your response. I found the solution. Its basically modified version of my approach 2. Modifications - 1. I had to click the SAPList before trying to select a value 2. A wait statement was needed after keystroke DOWN to give it enough time to actually select the options. With these changes. codeis working perfectly. Thanks again Niv RE: Setting a Value in SAPList - basanth27 - 05-10-2013 Good. Whatever works is good, however I wouldnt advise using a hard wait..Instead try to syncronize the object to complete the value selection. There should be a timeout or a property. If that doesnt work use Hard Wait as the last resort. RE: Setting a Value in SAPList - Amita Vaish - 09-13-2016 (05-10-2013, 06:43 AM)basanth27 Wrote: Good. Whatever works is good, however I wouldnt advise using a hard wait..Instead try to syncronize the object to complete the value selection. There should be a timeout or a property. If that doesnt work use Hard Wait as the last resort. Hi, Please find below lines of code, working perfactly. :-) Browser("Browser").Page("Page").SAPFrame("SMART UI").SAPList("Equipment Number").FireEvent "click" Browser("Browser").Page("Page").SAPFrame("SMART UI").SAPList("Equipment Number").Object.setAttribute "value", "Electricity" Browser("Browser").Page("Page").SAPFrame("SMART UI").SAPList("Equipment Number").Object.focus Browser("Browser").Page("Page").SAPFrame("SMART UI").SAPList("Equipment Number").Click set WshShell = CreateObject("WScript.Shell") WshShell.SendKeys "{DOWN}" WAIT(1) WshShell.SendKeys "{ENTER}" set WshShell=nothing RE: Setting a Value in SAPList - balahex - 02-19-2020 Hi, FYI, Following code, I worked for me. On Error Resume Next Browser("Browser_2").Page("Page").Frame("myActionIframe").SAPList("Tracking Scenario:").Click wait 1 pEachDropdownItem = "//*[@class='lsListbox lsListbox--popup lsLCDropShadow']//*[@class='lsListbox__value']" pTrackScenarioDropdown = "//*[@class='lsListbox lsListbox--popup lsLCDropShadow']" Set Desc = Description.Create Desc("micclass").value = "WebElement" Desc("xpath").value = pEachDropdownItem Set oObjs = Browser("Browser_2").Page("Page").Frame("myActionIframe").ChildObjects(Desc) if Browser("Browser_2").Page("Page").Frame("myActionIframe").WebElement("xpath:=" & pTrackScenarioDropdown).Exist(0) Then For ii = 0 To oObjs.Count Step 1 if oObjs(ii).GetROProperty("innertext") = "Manifest Query" then print "index:" & ii & ", value: " & oObjs(ii).GetROProperty("innertext") oObjs(ii).DoubleClick End If Next end if |