Verify Relative

I would like to suggest a different implementation of the XClick Relative to be an XVerify Relative. I have a few different applications I test that look similar, but are set up differently. I would like to verify that the status is changing when my tests run. I would love to use an X…Relative to test that the empty space next to the word “Status” (wherever it is on the page) changes.

If there’s already a way to do this that I am just missing, please let me know!

Thank you!

Relative to test that the empty space next to the word “Status” (wherever it is on the page) changes.

So you want to check that a certain area is empty?

I am not sure I fully understand the workflow. Can you post screenshots of these apps?

As shown below, the location of the field I’m looking for is changing from app to app, but the word “Status” always looks the same. I would like the ability to verify that whatever text is in the space next to the word “Status” is changing when I interact with the record in such a way that would result in a status change.

I would like to use it like:

XVerify Relative
next to ‘Status’ is ‘New’

XClick ‘Submit’ button

XVerify Relative
next to ‘Status’ is not ‘New’

statusPO

statusPR

statusTR

statusTV

There might be a way to do this with involved xpath/css, but it would be nice if that weren’t necessary. Since the ability to determine whether an image is available to click on it already exists, it doesn’t seem like a huge leap to use that functionality to determine whether an image is visible on the page or not.

With xpath axes you can detect relative element without using Xclick.

Xpath have this command now, need to study axes xpaths

Unfortunately ui vision do not record axes xpath but support it.

I can think of a few methods for this:

  1. XPath axes as @newuserkantu mentioned (tricky to create if you are not familiar with XPath, but fast and reliable if it works on this website.) Related forum posts:
    Help in Dynamic table reading - #6 by ulrich
    Store value from the right cell of the curent position - #2 by admin
    Add a relative command to detect relative element - #4 by admin

  2. SourceExtract: If the words status: ... are visible in the page source code, you can avoid XPath and simply use SourceExtract with a regular expression to get the words next to status.

Test macro: Status1: TR Div Chief Approval

Here in the forum this solution would work well. See the tesr macro below. It extracts the TR Div Chief Approval from this forum post.

  1. Use XType to send CTRL-A and CTRL-V (mark text and copy) to the website. Now the text is in the clipboard variable ${!clipboard}. You can then use ExecuteScript (Javascript) with the same regular expression as in #2. The advantage of this is that it works even if the the raw text is not in the page source, e. g. if gets generated on the fly by some AJAX calls.

  2. Extract the text visually with OCRExtractRelative: With this command you can extract the text next to the status word, and then check if it has changed before and after submit. Related posts:
    Single-digit number-OCR - #2 by admin
    How to Fetch table from image - #6 by admin
    How to automate a custom select box visually with OCR

image

Regex test macro for solution #2:

Regex result is: TR Div Chief Approval</code></p>

{
  "Name": "regex",
  "CreationDate": "2021-3-12",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://forum.ui.vision/t/verify-relative/7146/6",
      "Value": ""
    },
    {
      "Command": "sourceExtract",
      "Target": "regex=(?<=Status1:).*",
      "Value": "status"
    },
    {
      "Command": "echo",
      "Target": "Text next to \"Status:\" is ${status}",
      "Value": "green"
    }
  ]
}
1 Like

This is a great solution for my problem!

I would still very much like to see xVerify Relative implemented for ease of system use, but I’m glad to have a functional alternative. Thank you, @ulrich!

ocrExtractRelative is working for me, but I would prefer to not turn on OCR.

If you want to avoid OCR: I can suggest an improved method 3 from @ulrich: You can use

  • XClickRelative | image.png | #doubleclick (<=mark the text)
  • Xtype | ${KEY_CTRL+KEY_C}
  • Now the text is inside ${!clipboard}

image