1

How do you select an option or set the value in a select list that has option groups?

This method does not work: How to change a dropdown in an F# Canopy UI Testing Script

sample code:

<!DOCTYPE html>
<html>
<body>

<select id="test-select">
  <optgroup label="Swedish Cars">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
  </optgroup>
  <optgroup label="German Cars">
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
  </optgroup>
</select>

</body>
</html>

Canopy Test:

open canopy
open runner
open Helpers

    let all() =
    context "OptGroup Tests"

    let page = ""

    ntest ("Testing page " + page) (fun _ ->
        let mUrl = testpage.html
        url mUrl

        "#test-select" << "Audi"
    )
Community
  • 1
  • 1
chongo2002
  • 131
  • 1
  • 5
  • 12
  • Why does this method not work? What happens? Have you tried anything else? What results did you get? – Fyodor Soikin Mar 04 '16 at 14:58
  • The test times out looking for the element. If I remove the option groups it is able to set the value. I have tried executing some js, and it is able to select it then, however it needs to be more user friendly to QA. All my other selects work without optgroup. – chongo2002 Mar 04 '16 at 15:23
  • Could it have to do with capitalization? (i.e. `Audi` vs `audi`) – Fyodor Soikin Mar 04 '16 at 16:56
  • I am actually trying to select it by text value, not option value. That was a poor example I guess. Like I said without the optgroup it works. – chongo2002 Mar 04 '16 at 20:45
  • 1
    Its probably an oversite in canopy. I will work to fix this problem. – lefthandedgoat Mar 07 '16 at 15:31

0 Answers0