Select dynamic answer

I have a written 4 answers for a question , How I can select an answer read it form excel file?


https://i.imgur.com/n8JDspj.png

Hi @Alaa_Hammad
Do you want to read the ‘Correct Answer’ column and select the option on radio button as shown in the second image?

Can you please explain what is the expected behaviour of the bot?

1 Like

Yes exactly this is what I need.
First: open browser, and start write a question then its four answers, I did this without any problems, then I need to select the correct answer as in the excel file column “Correct answer”

Here is the basic approach:

  1. Scan any one (or two) radio button option(s) to see their structure. Look for attributes that hold the text value you’re looking for i.e. Country X
    Example:
    image
    By checking the selector (and using UiExplorer) I coded this value:
  2. Read the Correct Answer column and store the value in a variable.
    e.g. strCorrectAnswer = dataTable.Rows(0)("Correct Answer").ToString
  3. Update your selector to dynamically match the correct answer.
    You can do this by using this variable in the selector.
    image

    image
    {{variableName}} is the syntax to use variables in selectors

If you post a screenshot of the selector on one of those radio options, maybe we can help you better. :slight_smile:
I hope this helps.

1 Like

Thanks for your fast help, I have problem post a new screenshot, I am new here, and I think there are a mistake user imgur urls??!!!

In this case, change the aaname as follows:
aaname = '*{{correctAnswer}}*'

The asterisk ( * ) symbol on both sides will match the blank spaces, and the {{correctAnswer}} is a variable which you should assign before calling the Click activity which has this selector.

1 Like

I got this problem?

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