Robotic Process Automation (RPA)

 View Only
  • 1.  How to attach a opend browser as a window without open new browser

    Posted Thu March 02, 2023 01:43 AM

    There is SAP BEx Web Analyzer - SAP, I need right clicking mouse, so I need to get the position, but the position is changing from DEV to UAT/Product

    Here is the script:

    webFocus --selector "Id" --id "NAVIGATION_PANE_acQueryNavigation_navTree_unid27-cnt-start" --simulatehuman  --timeout "00:00:02" FocusTextUserName=value

    delay --timeout "00:00:02"
    mouse --mode "Move" --resolution "Absolute" --point "315,330"
    delay --timeout "00:00:01"
    mouseClick --clickevent "RightClick"

    I am trying to use below script to get the correct postion, but it asks to attach the window, When I tried to attach edge, it will open a new window.

            //getControl --selector "Id" --id "NAVIGATION_PANE_acQueryNavigation_navTree_unid63-cnt-start" bounds=bounds
            //setVar --name "${point}" --value "${bounds.X},${bounds.Y}"
            //mouse --mode "Move" --resolution "Absolute" --point "${point}"
            //mouseClick --clickevent "RightClick"

    Is there any solution for this request?



    ------------------------------
    Yan Hai Zhao
    ------------------------------


  • 2.  RE: How to attach a opend browser as a window without open new browser

    IBM Champion
    Posted Thu March 02, 2023 05:23 PM
    Edited by Martin Medina Thu March 02, 2023 05:24 PM

    I would not recommend going with absolute values to perform a right click on a web application. The GetControl requires a window, and you will have to choose whether your web application will be recognized as a browser or a window, but not both. You will get the most value by keeping it as a browser and finding a different way to perform a right click on your web application.

    IBM RPA does not support a right web click, so I will propose a slightly different solution in the meantime.

    Here's an example of how you can use JavaScript to right-click an element on a webpage:

    // Find the element you want to right-click on const element = document.getElementById('NAVIGATION_PANE_acQueryNavigation_navTree_unid27-cnt-start'); // Create a new MouseEvent object const mouseEvent = new MouseEvent('contextmenu', { bubbles: true, cancelable: true, view: window, button: 2, // 2 is the right mouse button clientX: element.getBoundingClientRect().x, clientY: element.getBoundingClientRect().y }); // Dispatch the event on the element element.dispatchEvent(mouseEvent);

    This code finds the element with ID 'NAVIGATION_PANE_acQueryNavigation_navTree_unid27-cnt-start' and creates a new MouseEvent object with the 'contextmenu' event type, which simulates a right-click event. The clientX and clientY properties of the event are set to the element's position on the page, so the right-click menu will appear at that location.

    You can adjust the code to work with your specific use case and integrate it into your RPA script as needed.



    ------------------------------
    Martin Medina
    Salient Process
    ------------------------------



  • 3.  RE: How to attach a opend browser as a window without open new browser

    Posted Sun March 05, 2023 01:39 AM

    @Martin Medina Thanks. I tried and the element retuns null, from HTML code, the ID should be correct.

    <tbody>
    <tr>
    <td valign="top">
    <img align="top" id="NAVIGATION_PANE_acQueryNavigation_navTree_unid63-exp" src="/com.sap.portal.design.urdesigndata/themes/portal/sap_tradeshow_plus/common/1x1.gif" class="urTreExpNc">
    </td>

    <td class="urFontStd" tabindex="-1" ti="-1" width="100%" nowrap="" container="true"
    id="NAVIGATION_PANE_acQueryNavigation_navTree_unid63-cnt-start" level="2" sellevel="0"
    onmouseover="sapUrMapi_TreeNode_mouseover('NAVIGATION_PANE_acQueryNavigation_navTree_act',
    'NAVIGATION_PANE_acQueryNavigation_navTree_unid63',event);">

    <span ct="BIDD" id="NAVIGATION_PANE_acQueryNavigation_navTree_unid64"
    style="display:inline;cursor:hand;cursor:pointer;" item="NAVIGATION_PANE"
    ac="NAVIGATION_PANE_acQueryNavigation" tp="207">

    <span id="NAVIGATION_PANE_acQueryNavigation_navTree_unid65" ct="TV"
    title="Invoice Text - Navigate using drag and drop or using the context menu. Drop an element on another element to swap them. Drag and drop an element to remove it"
    class="urTxtStd">Invoice Text</span>

    </span>
    </td>

    <td>
    <span id="NAVIGATION_PANE_acQueryNavigation_navTree_unid63-cnt-end" onfocus="sapUrMapi_Tree_controlExit('NAVIGATION_PANE_acQueryNavigation_navTree_act','NAVIGATION_PANE_acQueryNavigation_navTree_unid63',event);">
    </span>
    </td>
    </tr>
    </tbody>
    </table>
    Do you have any advice?


    ------------------------------
    Yan Hai Zhao
    ------------------------------



  • 4.  RE: How to attach a opend browser as a window without open new browser

    Posted Mon March 06, 2023 12:39 AM

    It seems that the element you are trying to access is nested within multiple levels of tables and containers. Sometimes, it may not be possible to access a specific element directly using its ID due to the complex structure of the HTML code.

    One possible solution is to use the relative XPath of the element to locate it. You can use the "Find XPath" option in your browser's developer tools to generate the relative XPath of the element. downgraf

    For example, in Google Chrome, you can right-click on the element and select "Inspect". Then, right-click on the highlighted code and select "Copy" -> "Copy XPath". This will copy the relative XPath of the element to the clipboard, which you can use in your RPA script to locate the element.

    Alternatively, you can try using other attributes of the element such as class name, tag name, or text content to locate it. For example, if the element has a unique class name, you can use it to locate the element using the "Find Element" activity in your RPA script.



    ------------------------------
    james wise
    ------------------------------



  • 5.  RE: How to attach a opend browser as a window without open new browser

    Posted Mon March 06, 2023 01:11 AM

    james wise, Yes, like what you said, getElementbyID can handle simple page, the page contains frames and has complex elements, so it fails to get the elements.

     I'll follow your advice to try other solution, thanks your advice.



    ------------------------------
    Yan Hai Zhao
    ------------------------------



  • 6.  RE: How to attach a opend browser as a window without open new browser

    Posted Wed March 08, 2023 02:29 AM

    Sharing the final solution for collegues'reffering.

    if there are many Frames, but only first part of frame can be spyed , so after spying Fram2, then

                const iframe2 = document.getElementById("iFrame2");

                const iWindow = iframe2.contentWindow;

                const iDocument = iWindow.document;

    using the iDocument to syp the Frame3 and Frame4 then we can get the elements under Frame4.

    Frame1 can be spyed

          Frame2 can be spyed

                 Frame3 can't be spyed

                           Frame 4 can't be spyed



    ------------------------------
    Yan Hai Zhao
    ------------------------------



  • 7.  RE: How to attach a opend browser as a window without open new browser

    Posted Mon August 14, 2023 05:41 AM

    Hi All,

    I'm facing similar issue- a lookup icon has to be identified on the webpage with developer tools disabled.

    With UiPath's recording and target editing, it was accomplished.

    While trying the similar approach with IBM RPA, it requires "attach window".

    Kindly share your suggestions to achieve registering a browser instance as a window.

    Thanks in advance.



    ------------------------------
    Durga Bhavani Uppuluru
    ------------------------------