Check when element is not visible

Hi guys,
I have a new question for you.
How do I know when an item is no longer visible on the screen?
it’s a web element but I can’t use a selenium or any web driver.
I’m using rpa.windows to inspect the GUI and it works perfectly. but now I have this problem.
Do you know any method to solve this?

1 Like

Hi Salvatore,

Using rpa.windows you could combine a keyword like Get Element with Run Keyword And Return Status

Set the timeout short on Get Element and check the result of Run Keyword And Return Status to find out if the element was found (True) or not found (False)

From my quick look at rpa.windows I didn’t see a better way.

If you can use other libraries you could also use an image recognition library like SikuliLibrary or ImageHorizon Library.

Hope that helps,

Dave.

2 Likes

I create a Keyboard like this:

Check Exist Loading
    ${loading}=    Set Variable    ${TRUE}
    WHILE    $loading
        TRY
            Get Element    id:divLoadingElem1 depth:99    timeout=1
        EXCEPT
            ${loading}=    Set Variable    ${FALSE}
        END
    END
    RETURN
1 Like

@StratoKyke for thought:

The WHILE keyword holds a default limit of 10000 iterations this can be controlled with arg limit=value, you may find that given the timeout of 1 second you have this “Check Exist Loading” keyword may take a while to resolve.

You can remove the Try/Except and use as @damies13 suggested, which I believe they where suggesting in chaining the two with Get Element
${isVisible}= Run Keyword And Return Status Get Element ......

You may want to consider handling the WHILE for when it hits the limit (default or user-passed limit) as it will throw an exception, and FAIL here (this may be the desired outcome, but just for thought) but this can be handled in a couple of ways on either the calling keyword or the inner workings of the keyword.

Thanks

2 Likes

Hi,
i am coming frome one window to another
in second window i am doing some settings its failing
because coming from 1st window to second windows going very quickly some fraction of milli seconds
i gave sleep with 60s also its not worked

how to check in desktop is the element is visible
Which keyword we need to use

Hi,

If you added a 60s sleep and nothing is found, as you switch windows maybe the new one is not active…
You should consider to use Switch Window or Switch browser, then use a Wait Until Page Contains or Wait Until Element xxxx (depending of the element or content you seek).

Also verify maybe selected frames in the new Window. Maybe your element is in an iFrame or something else. So even user visible, it may not be usable for RF.
You may Select Frame in this case (and don’t forget to Unselect after actions are done).

Regards.

Charlie

1 Like

Hi,
Thank you for the response.
i am using RPA.Desktop and RPA.Windows
I Tried RPA.Desktop — Wait For Element with image
but image thing is failing in my pc
and tried Wait For Element with automation id
same its failed
Any other ways

Hi,

OK, so my previous answer was more browser oriented… So this might not be helpful.
You’re working on Windows OS ?
And when you mentioned earlier “from one window to another” you meant two different applications?

In this case you could maybe use this to switch, I’d being the ID of the target app :

${appslist}    Get Open Applications
Switch To Application    ${appslist[id]}

You can use also Get App after opening to obtain the ID. Then use Find Element or Is Visible.

If it’s a window, maybe :

Get Window List

Then I’m not sure how to access/switch to it (Open dialog or Connect by handle).

Regards.

Charlie

Hi,
sorry,I am using only one application.From one screen to another screen i am going
i am working on Windows OS
mine is desktop application

This can mean a lot of different things, can you show some screen shots to clarify what you mean?

Also as per my previous comment to Salvatore, if the navigation is being troublesome it might be worth using another library to coax the application to the screen you want and then switch back to RPA.Desktop for the rest of the test. Sometimes desktop apps can be cantankerous.

Dave.

HI,
There are four buttons once i logged into application
i clicked on new experiment
the dialog will display like this

Once i click on on the dialog .screen looks like this


I am trying to access some of the controls in the second screen which are having automation id or with names
When i run individual tests when the test become successfull
when i ran hole project its failing
I written code like this

Here i am trying to change collection panel setting
instrument seeings
adding plot to workspace

I’m just guessing here, some apps do weird things when you do an action that closes a dialogue like that, I’ve seen a few where the main window remains in the background even when the title bar has the appearance of being the foreground or active window (not sure if it’s the app or windows at fault)

Try clicking the title bar first, also try clicking the apps icon/button on the start bar, basically do an action to trigger windows to bring the window to the foreground or make it the active window.

Dave.

1 Like

HI,
Its in main screen only
Thank you it worked.

1 Like

HI team,
In main screen i got one dialog without title ,Inside of that dialog some title text and some context are there with Next and cancel buttons
That dialog dose not have Automation id and Name
I tried with inside text using Control Window but its not identifying
Any idea on this?

and how to handle model dialogs in desktop applications

A dialogue with no title bar test, Automation id or Name, sounds like it should be a defect to me.

I would first push back with a defect and mark that dialogue and anything that need passing that dialogue as blocked

If you need to work around it, you could try

  • use ${EMPTY} as the title bar text (I’ll give this about 1% chance of working, but I’d try it just to see if it worked, sometimes you get lucky
  • clicking “inside text” with image recognition (screen shot of the label)
  • Use the ocr feature of RPA: Click ocr:"inside text"
  • use Press Keys to send Alt + Tab and try to action the dialogue, repeat till it succeeds (this is a pretty ugly approach)

Dave.

i tried image recognition for different thing its not working
I tried below things
Installed rpaframework,rpaframework-recognition using pip
installed tesseract
added rpaframework-recognition==5.0.1,tesseract in conda.yaml

Let me know if any additional things needs to add ?

I actually never used the RPA libraries, so I’m not sure what’s required for them, sorry can’t answer that.

Dave.