How to set the chrome as the active application/window?

Hi,

I’ve been wondering what is the correct method to set chrome as the active window.

Sequence is (1) open new tab, (2) write something using type text. Step 2 doesn’t work on this sequence. I’ve tried typing {ENTER} on it but still not working.

Click element works but I don’t want to use it for some reasons.

type text should always be the very vey last resort.
Use item.text and if that does not work, item.SendText

if you cannot avoid using typetext you must give the field you want to type into, focus first, and to do that, you need to use element click with “Virtual” set to false

Are you trying to type something in chrome address bar or in some chrome extension?

One of my use case was to upload a file in GDrive using only OpenRPA.
Initial state:
• Chrome not yet opened
• Notepad as the focused application (may or may not have active app/window)

Based on the snippet:

  1. Chrome was freshly opened. New tab was created.
  2. Chrome was not focused on the entire workflow. (That is why it is on orange state on the taskbar)
  3. Text was typed on the notepad in which it is the initial active application.

PS: I already included focus element both windows and NM.

I will suggest you to activate window try to click on anywhere on window and please make sure virtual click is turned off

I occasionally see some Windows machines that do not respect using Windows APIs to give a window focus, but instead make it flash in the taskbar.

No one has ever been able to explain to me what they configured or installed to make Windows do that, so I cannot assist you in how to “fix it” except to say, this is NOT default Windows behavior. Hopefully, someone else on this forum has seen it and knows how to “revert it back” to proper Windows default?

ps: getting any element inside a window ( using get element under windows components ) should make openrpa try and give it focus, but generally you would simply get the window itself.

if you tried giving a chrome element focus, that is something completely different, that is about bringing the element into the viewport

This too doesn’t work if the initial active window consumes all screen space.

Yeah. I guess our system was not set to default settings.

Dirty solution:

  1. AutoHotKeys (displays the app on top)
  2. Get window element > Either click or type text to set the app as the active one
1 Like

That is super interesting. Can you give me the steps needed to reproduce that? Preferably only using default applications on a Windows machine, since I only have Windows and Visual Studio on my machine…

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.