Feature Requests & Ideas

For bug reports and questions, please use the in-app chat or support@mabl.com.

Like to use a Javascript returned variable to set a dropdown selection.

In my tests, I want to randomly select an item in a dropdown.

I created a javascript variable to achieve this but when I went to use I got the error:

"Variables can only be inserted into text fields."

 

My sample JavaScript:

function mablJavaScriptStep(mablInputs, callback) {

    var regions = ['US (Oregon)', 'US (Ohio)', 'US (N. Virginia)', 'Europe (Ireland)', 'Europe (London)', 'Europe (Frankfurt)']

    var random_region = regions[Math.floor(Math.random() * regions.length)];

    let result = random_region;

    callback(result);

}

 

The dropdown is a region drop-down and I want to select a random region.

But, unfortunately, MABL only supports input text fields with respect to variable assignment.

  • Peter Phelan
  • Apr 10 2019
  • For Consideration
  • Attach files
  • Brent Engelman commented
    16 May 19:24

    I use a similar script and it works for my drop downs.I had a similar issue though for phone number as when you type the field their was formatting error. You might have to check if the field has forced formatting

Copyright © 2019 mabl Inc. All rights reserved.