Translate Projects (Get Text-Get Attribute)

Hi everyone,

I’m building a UiPath automation that takes a list of words in Turkish and translates them using Google Translate. Here’s what my process looks like:

  • I loop through each word in an Excel file using For Each Row.
  • I type the word into the Google Translate input field using Type Into.
  • Then I try to retrieve the translated output using either Get Attribute or Get Text.

However, instead of the actual translation result, I always get a fixed value like “çeviri” (which just means “translation” in Turkish). It seems like I may be targeting the wrong element, but even after re-indicating the correct output element, I still can’t get the dynamic translation result.

My questions are:

  • Why am I not able to retrieve the actual translation result from Google Translate?
  • Should I use Get Text, or is there a better approach for capturing the translated content dynamically?
  • Has anyone faced a similar issue, and what would be the best way to handle this?

Thanks in advance for your help :folded_hands:

Hi @Emir_Ahukus,

I just checked google translate and it takes some time to provide you the output which means there is delay in response.

Could you try adding a delay of about 5 seconds between the Get Text activity and the Get Attribute activity?

If this doesn’t work, kindly share a screenshot of the selector editor of the Get Attribute activity.

All the best.

Yes it doesn’t work.

i see.

As I see you were not using any delay between those two activities, recommend to use delays.

Let me give you a steps i hope it will help you.

Aim is use to while loop and it will run till we get the translation and exit if takes too much time.

Step 1: create variable startTime of DateTime and pass Now (this is to get current time)
create variable exitLoop of Boolean type and pass value False.

Step 2: use do while activity in condition pass not equal to exitLoop(!=exitLoop)

Step 3: in the body of do while use the same Get attribute activity which you were using, just make it take the inntertext or Text attribute(if available any) instead of aaname.
after this add the 5 sec delay activity.

Step4:
Add If condition activity.
Pass the condition as translationText != “çeviri” (assuming translationText variable is the output variable of Get attribute activity. replace it with proper one)
in Then:
add the assign activity and pass exitLoop = True .

Step 5:

Add another If condition activity.
Pass the condition as (Now - startTime).TotalSeconds > 60 (this condition is for help you stop the loop running forever in case the text çeviri take takes a lot of time, you can increase 60 to other as per your convenience)
in Then:
add the assign activity and pass exitLoop = True .
add write line and pass some string “Timeout” (this will help you know when the there is timeout)

Step 6:
outside loop you can either use the output variable of Get attribute activity or if didnt work use Get text activity.

Try this steps and let me know if it works.

All the best.

@Emir_Ahukus,

For translating the text, you can use UiPath GenAI activity - Activities - Translate Language

  1. Using Google Translate API in UiPath
    You can call the Google Translate API using UiPath’s HTTP Request activity.
    Send the Turkish text to the API and get the translation in your desired language.
    This requires a Google Cloud account and enabling the Translate API.
    Check the response 200 as per that you can perform further action
    Example workflow steps:
  2. Use HTTP Request activity.
  3. Configure the request with API endpoint, key, and text to translate.
  4. Parse the JSON response to get the translated text.