fbpx

Compare GetText values to Datatable items

Compare GetText values to Datatable items

Home Forums Ask Expert Compare GetText values to Datatable items

  • This topic has 4 replies, 2 voices, and was last updated 7 years ago by Sasha ZAP.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #31569
    Mark Webb
    Participant

      I’m trying to compare an object text value using GetText to an item in the datatable, but it’s failing the comparison.
      I’ve even put in message boxes that display both values, and although the values are the same, the comparison fails.
      Script:
      ‘parameters
      site_url = “http://199.189.178.11/OnlineServicing/Welcome.aspx#Login”
      input_pnum = Cstr(Datatable.Value(“PolicyNumber”))

      ‘Open device browser using datatable option
      Application(“OLS Mobile”).Launch Datatable.Value(“Browser”),site_url

      ‘Enter username and password – RightClick makes the keyboard go away
      Application(“OLS Mobile”).View(“Login”).Object(“label_UserID”).Object(“textbox_UserID”).Type Datatable.Value(“Username”)
      Application(“OLS Mobile”).View(“Login”).Object(“label_UserID”).RightClick
      Application(“OLS Mobile”).View(“Login”).Object(“label_Password:”).Object(“textbox_Password”).Type Datatable.Value(“Password”)
      Application(“OLS Mobile”).View(“Login”).Object(“label_Password:”).RightClick
      Application(“OLS Mobile”).View(“Login”).Object(“button_Log In”).Click

      ‘Click Menu button and view Policy Info
      Application(“OLS Mobile”).View(“Billing”).Object(“button_Menu”).Click
      Application(“OLS Mobile”).View(“Menu”).Object(“link_PolicyInfo”).Click
      Application(“OLS Mobile”).CustomReport true, “Policy Info Loaded”,”Test Passed”
      policynum = Application(“OLS Mobile”).View(“HomeownerPolicyInfo”).Object(“txt_PolicyNumber”).GetText
      Application(“OLS Mobile”).CustomReport true, “Policy Number”,policynum
      Application(“OLS Mobile”).View(“HomeownerPolicyInfo”).Object(“link_ClosePolicyInfo”).Click

      If policynum = input_pnum then
      msgbox “success”
      else
      msgbox “failed”
      end If
      msgbox “Policy# ” + policynum
      msgbox “Input Table# ” + input_pnum

      #31570
      Mark Webb
      Participant

        I also tried this:
        Application(“OLS Mobile”).View(“PolicyInfo”).Object(“txt_PolicyNumber”).Contains(input_pnum)
        But got this back in the report:
        38 PolicyInfo txt_PolicyNumber Contains Text “34956912” not found in object string: “”

        Even though the result of this:
        policynum = Application(“OLS Mobile”).View(“HomeownerPolicyInfo”).Object(“txt_PolicyNumber”).GetText
        Application(“OLS Mobile”).CustomReport true, “Policy Number”,policynum
        Produced:
        40 OLS Mobile Policy Number 34956912

        #31571
        Sasha ZAP
        Moderator

          Hello mark.webb,

          Regarding your first post please try the following:
          policynum = CStr(Application(“OLS Mobile”).View(“HomeownerPolicyInfo”).Object(“txt_PolicyNumber”).GetText)
          In the condition section you can also use:
          If InStr(policynum, input_pnum) > 0 then…

          If the above still will not work:
          Can you please attach a screenshot of the page you are trying to check and specify which of its items you have trouble with (Please do not mark anything in the screenshot itself so we can work on it).

          Thanks,
          ZAPTEST Team

          #31576
          Mark Webb
          Participant

            The solution provided worked. Thanks very much for your quick response!

            #31577
            Sasha ZAP
            Moderator

              Thank you mark.webb.

              Thanks,
              ZAPTEST Team.

            Viewing 5 posts - 1 through 5 (of 5 total)
            • You must be logged in to reply to this topic.

            Virtual Expert

            ZAPTEST

            ZAPTEST Logo