KAPOW

Would you like to react to this message? Create an account in a few clicks or log in to continue.
KAPOW

Welcome to the Kapow forum. Here you can get help, use your skills to help others and enjoy hanging out in the company of other Kapow Robot Developers.


    Desktop Automation - Extracting text from an empty textbox

    avatar
    tmc51


    Posts : 6
    Points : 1564
    Join date : 2020-02-04

    Desktop Automation - Extracting text from an empty textbox Empty Desktop Automation - Extracting text from an empty textbox

    Post by tmc51 Thu Mar 19, 2020 4:44 am

    Hi all,

    Looking for some recommendations on best practice to work around the below issue.

    When using desktop automation with a windows form app, extracting a value from a text box (using the attribute text), DA throws an error when the textbox is empty as the 'text' attribute does not actually exist.
    I figured I could just wrap the 'extract value' step in a try-catch but this did not actually help, neither did using the extraction type of 'Text'.

    The reason for this is that occasionally we will come across fields where someone has not input data so trying to handle the exceptions.

    Any suggestions appreciated.

    Regards
    avatar
    tmc51


    Posts : 6
    Points : 1564
    Join date : 2020-02-04

    Desktop Automation - Extracting text from an empty textbox Empty Re: Desktop Automation - Extracting text from an empty textbox

    Post by tmc51 Thu Mar 19, 2020 10:18 am

    I actually found a solution to this however I am sure there must be a better way.

    The method I used was to export the tree into a variable via the option 'Extract Tree as XML String',
    then do a conditional step to check for the existence of the substring 'text=', if successful then continue with the 'extract value' step.

    Still open to an alternative, cheers.

      Current date/time is Mon May 06, 2024 10:03 pm