Trying to capture <span>text</span> that quickly disappears from the page

Hello,
I am trying to catch text that quickly disappears from the page when you click on apply changes button. This notice is the only thing that will confirm that the configuration has been saved and the macro run successfully. I wanted to implement if Configuration reloaded! then macro run OK if the text does not match then trow error.
I managed to record my screen and slow down the video so I can see what I need to add to the code.

I have tried to add xpath=/html/body/div/div/span/div/div/div/span/ to verifyText but that does not seem correct.

Any advice what would be the right command, target, value and how to do error checking.

Thanks.

Hi, you posted a screenshot. Can you please post a video of this situation, too? Then we can better see what is going on.

1 Like

Here is the video and the code recorded with steps (can’t upload to forum as I am a new user)

Here is the code generated but it’s not correct:

{
  "Name": "demo",
  "CreationDate": "2022-6-15",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://pbx:8090/userpotal/user-basic-information/userExtension",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "xpath=//*[@id=\"app-root\"]/div/div/div/div/div[2]/section/div/div/div/div[2]/button[3]",
      "Value": "",
      "Targets": [
        "xpath=//*[@id=\"app-root\"]/div/div/div/div/div[2]/section/div/div/div/div[2]/button[3]",
        "xpath=//button[3]",
        "css=#app-root > div > div > div > div > div.app-main > section > div > div > div > div.content-operation.display-block.tab-operations > button.ant-btn.ant-btn-primary.save.save-button-in-header.undefined"
      ],
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "xpath=//*[@id=\"applyChanges_div\"]/button",
      "Value": "",
      "Targets": [
        "xpath=//*[@id=\"applyChanges_div\"]/button",
        "xpath=//button[@type='button']",
        "xpath=//button",
        "css=#applyChanges_div > button"
      ],
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "xpath=/html/body/div[2]/div/span/div/div/div/span",
      "Value": "",
      "Targets": [
        "xpath=/html/body/div[2]/div/span/div/div/div/span",
        "xpath=//span/div/div/div/span",
        "css=body > div:nth-child(7) > div > span > div > div > div > span"
      ],
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "xpath=/html/body/div[2]/div/span/div/div/div/span",
      "Value": "",
      "Targets": [
        "xpath=/html/body/div[2]/div/span/div/div/div/span",
        "xpath=//span/div/div/div/span",
        "css=body > div:nth-child(7) > div > span > div > div > div > span"
      ],
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "xpath=/html/body/div[2]/div/span/div/div/div/span",
      "Value": "",
      "Targets": [
        "xpath=/html/body/div[2]/div/span/div/div/div/span",
        "xpath=//span/div/div/div/span",
        "css=body > div:nth-child(7) > div > span > div > div > div > span"
      ],
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "xpath=/html/body/div[2]/div/span/div/div/div/span",
      "Value": "",
      "Targets": [
        "xpath=/html/body/div[2]/div/span/div/div/div/span",
        "xpath=//span/div/div/div/span",
        "css=body > div:nth-child(7) > div > span > div > div > div > span"
      ],
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "xpath=/html/body/div[2]/div/span/div/div/div/span",
      "Value": "",
      "Targets": [
        "xpath=/html/body/div[2]/div/span/div/div/div/span",
        "xpath=//span/div/div/div/span",
        "css=body > div:nth-child(7) > div > span > div > div > div > span"
      ],
      "Description": ""
    }
  ]
}

@admin is this OK? Should I upload the videos on another host?
If I try to upload video via forum I get this:

Thanks, I got them =>
Videos:

Message:

The message is really tricky to catch because it disappears quickly.

Suggestion: Can you confirm the loaded configuration in some other way e. g. by storing and then extracting (as test) some data?

One way would be to confirm that the Apply Changes button is gone and the value in call forward is correct as set in macro. I am having trouble now that the Apply Changes is not executing the macro is closed too quickly. I have tried the wait commands without any success. It’s a strange way how the site does the apply changes it’s some kind of animation not page reload.

Any advice how to verify that button is gone. I will try to do something tomorrow but I have already spend more hours that I want to admit trying to get this working.
It’s just so hard to make things robust as this user portal that I am trying to automate is so bad.

One way would be to confirm that the Apply Changes button is gone

This is a good idea. => You can use the VisualSearch command to wait for a button to disappear.

Actually in your case - because everything goes so fast - you do not have to wait at all (so no RepeatIF loop needed).

You can just verify that the “Apply changes” button is really gone. In below code visualSearch searches up to 5 seconds for the button, and if none is found, returns 0.

  • store | 5 | !timeout_wait reduce wait time
  • visualSearch | Image_of_ApplyChangesButton.png | found
  • if | ${found} == 0 | .... - verify that the button is not visible.

Another option is to extract the color of the area where the button should be and make sure the color is black (=> so no button visible).

@admin this does not help me at all unfortunately. My macro is closing before the apply is done. I have tried everything and it’s not waiting for click to execute fully. How can I fix that?
Also it’s so unpredictable if I try to run it in the browser it works fine if I try to run it via task it will not apply fully. Makes it really hard to understand what is going on.
If I can’t fix this until the end of the week I am moving to another solution because this is just unusable.

Just to clarify: So it works when you run the browser manually but fails via command line?

If so, what is the command line you are using?

@admin
Program/script: “C:\Program Files\Google\Chrome\Application\chrome.exe”
Add arguments
“file:///C:\Script\nameofscript.html?direct=1&macro=nameofscript&closeRPA=1&closeBrowser=1&savelog=nameofscript.txt”

EDIT:
My mistake even if I run the macro manually it will not apply correctly. Any advice how to after click wait for page to apply properly? I have tried different wait commands without any success.
Looks like the macro is ending before the apply is complete. In the browser it looks like the apply is still loading but the macro is already over so it’s not. If I try to refresh the page I can see that it was not applied…

@admin I have also tested with XClick but I am getting this error when I run in the command line mode via task scheduler. Command line options are the same as noted above.

Executing: | XClick | xpath=//*[@id=“applyChanges_div”]/button/span | | [error] E201: Failed to XClick viewport coordinates at [870.703125, 23.5]

I see you need to actually have an active session on the machine that is running the macro. This is a big drawback but it looks like it works… Now have to figure out how to make sure user will stay logged in all the time and active…