admin管理员组

文章数量:1391995

I am referencing a page that has a select element that looks like this:

<select id="make" name="Make">
  <option value="default">– please select –</option>
  <option value="Audi">Audi</option>
  <option value="BMW">BMW</option>
  <option value="Ford">Ford</option>
  <option value="Honda">Honda</option>
  <option value="Mazda">Mazda</option>
  <option value="Mercedes Benz">Mercedes Benz</option>
  <option value="Nissan">Nissan</option>
  <option value="Opel">Opel</option>
  <option value="Porsche">Porsche</option>
  <option value="Renault">Renault</option>
  <option value="Skoda">Skoda</option>
  <option value="Suzuki">Suzuki</option>
  <option value="Toyota">Toyota</option>
  <option value="Volkswagen">Volkswagen</option>
  <option value="Volvo">Volvo</option>
</select>

Inside my test case I am using this statement:

grab value by description "make" using AI to get all the option elements and concatenate their values and save them to "optionslist"

The result I get from TestRigor is this:

AI grabbed value '– please select –' because 'The "Make" field in the screenshot is a dropdown menu with the default value set to "– please select –," as indicated by the red border and the text displayed in the dropdown. Since no specific value has been selected, the field remains in its default state.' Stored value 'optionslist' was set to '– please select –'

What I expected was the last sentence above to say

Stored value 'optionslist' was set to

'– please select –AudiBMWFordHondaMazdaBenzNissanOpelPorscheRenaultSkodaSuzukiToyotaVolkswagenVolvo'

What should I do to get the expected result?

I am referencing a page that has a select element that looks like this:

<select id="make" name="Make">
  <option value="default">– please select –</option>
  <option value="Audi">Audi</option>
  <option value="BMW">BMW</option>
  <option value="Ford">Ford</option>
  <option value="Honda">Honda</option>
  <option value="Mazda">Mazda</option>
  <option value="Mercedes Benz">Mercedes Benz</option>
  <option value="Nissan">Nissan</option>
  <option value="Opel">Opel</option>
  <option value="Porsche">Porsche</option>
  <option value="Renault">Renault</option>
  <option value="Skoda">Skoda</option>
  <option value="Suzuki">Suzuki</option>
  <option value="Toyota">Toyota</option>
  <option value="Volkswagen">Volkswagen</option>
  <option value="Volvo">Volvo</option>
</select>

Inside my test case I am using this statement:

grab value by description "make" using AI to get all the option elements and concatenate their values and save them to "optionslist"

The result I get from TestRigor is this:

AI grabbed value '– please select –' because 'The "Make" field in the screenshot is a dropdown menu with the default value set to "– please select –," as indicated by the red border and the text displayed in the dropdown. Since no specific value has been selected, the field remains in its default state.' Stored value 'optionslist' was set to '– please select –'

What I expected was the last sentence above to say

Stored value 'optionslist' was set to

'– please select –AudiBMWFordHondaMazdaBenzNissanOpelPorscheRenaultSkodaSuzukiToyotaVolkswagenVolvo'

What should I do to get the expected result?

Share Improve this question asked Mar 16 at 14:06 WayneRoseberryWayneRoseberry 10114 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Yes, you can use JavaScript to achieve this. The AI command which you were using context is wrong as well.

本文标签: How to get the value of all the option elements under a select element using TestRigorStack Overflow