简体   繁体   中英

SAP GUI automation using Blueprism. The text box id is getting changed frequently. So not able to spy the text box

I am trying to automate one of the SAP screen using Blueprism. The Id of the text box is getting changed frequently. So not able to spy the text box.

I have spyed the elements using SAP mode. As the ID's are getting changed dynamically (approximately 6 hours) for the text boxes, Blue Prism is not able to identify the elements and the process is getting failed.

ID is: session.findById("wnd[0]/usr/subSUB_MAIN:/COCKPIT/SAPLDISPLAY46:0385/subSUB_HDR:/COCKPIT/SAPLDISPLAY46:0405/tabsG_STRIP_HDR/tabpTAB5/ssubSUB:/COCKPIT/SAPLDISPLAY46:0436/ssubSUB_OTHERS:%_ T000KW :0200/ctxt/COCKPIT/SHDR_DISP-RPA").text = ""

Here the highlighted value "T000KW" will be changing freequently. Can any one please help me how to handle this issue.

tl;dr: You should probably get the changing GuiComponent's ID, and use it. In the worst case, you can detect the GuiComponent's parent and list its children's IDs.

There are several approaches, some of them might eventually work:

  1. When spying in Application Modeller, the matching mode of the properties are by default set to be Equal. Sometimes loosening the matching condition helps.

    1. Try matching by wildcards, as such wnd[0]/usr/subSUB_MAIN:/COCKPIT/SAPLDISPLAY46:0385/subSUB_HDR:/COCKPIT/SAPLDISPLAY46:0405/tabsG_STRIP_HDR/tabpTAB5/ssubSUB:/COCKPIT/SAPLDISPLAY46:0436/ssubSUB_OTHERS:%_*:0200/ctxt/COCKPIT/SHDR_DISP-RPA
    2. Same with Regex: wnd\\[0\\]/usr/subSUB_MAIN:/COCKPIT/SAPLDISPLAY46:0385/subSUB_HDR:/COCKPIT/SAPLDISPLAY46:0405/tabsG_STRIP_HDR/tabpTAB5/ssubSUB:/COCKPIT/SAPLDISPLAY46:0436/ssubSUB_OTHERS:%_.*:0200/ctxt/COCKPIT/SHDR_DISP-RPA
    3. You have the possibility to get a list of children for the wnd[0]/usr/subSUB_MAIN:/COCKPIT/SAPLDISPLAY46:0385/subSUB_HDR:/COCKPIT/SAPLDISPLAY46:0405/tabsG_STRIP_HDR/tabpTAB5/ssubSUB:/COCKPIT/SAPLDISPLAY46:0436/ component (with a Code stage for sure, but maybe even with a Read stage) - thus detecting the changing part. With this information you can set a Dynamic match mode for your element, where the you are calculating the ID based on that information.
  2. Instead of an Application Model, interact with SAP using a code stage (this is what I usually do). There you can emulate the above (1.3.) method, by getting the non-changing element's immediate children, and calculating the element's ID. The SAP GUI object model's documentation is pretty good. Once I faced the exact same problem you have, and this how I actually solved it.

Please note, I'm writing this answer at home, without currently accessing Blue Prism. Or SAP.

I'd probably try to use a different spying mode in that situation. Have you tried using it here?

The other solution would be to use SAP API with code stages as Bálint Erdősi suggests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM