(CommandList
  children: [
    (C {(set)} {(-o)} {(pipefail)})
    (C {(shopt)} {(-s)} {(extglob)})
    (FuncDef
      name: main
      body: 
        (BraceGroup
          children: [
            (C {(Lit_Other ':')} 
              {
                (DQ 
                  (BracedVarSub
                    token: <VSub_Name WEBDRIVER_URL>
                    suffix_op: 
                      (StringUnary
                        op_id: VTest_ColonEquals
                        arg_word: 
                          {('http:') (Lit_Slash /) (Lit_Slash /) ('127.0.0.1:4444') (Lit_Slash /) (wd) 
                            (Lit_Slash /) (hub)
                          }
                      )
                    spids: [103 114]
                  )
                )
              }
            )
            (Sentence
              child: 
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:cmd)
                      op: Equal
                      rhs: {($ VSub_Number '$1')}
                      spids: [119]
                    )
                  ]
                  spids: [119]
                )
              terminator: <Op_Semi ';'>
            )
            (C {(shift)})
            (Case
              to_match: {($ VSub_Name '$cmd')}
              arms: [
                (case_arm
                  pat_list: [{(new-session)}]
                  action: [(C {(wd-new-session)})]
                  spids: [133 134 139 16777215]
                )
                (case_arm
                  pat_list: [{(delete-session)}]
                  action: [(C {(wd-delete-session)})]
                  spids: [142 143 148 16777215]
                )
                (case_arm
                  pat_list: [{(go)}]
                  action: [(C {(wd-go)} {(DQ ($ VSub_At '$@'))})]
                  spids: [152 153 162 16777215]
                )
                (case_arm
                  pat_list: [{(back)}]
                  action: [(C {(wd-post-session)} {(/back)})]
                  spids: [165 166 173 16777215]
                )
                (case_arm
                  pat_list: [{(forward)}]
                  action: [(C {(wd-post-session)} {(/forward)})]
                  spids: [176 177 184 16777215]
                )
                (case_arm
                  pat_list: [{(refresh)}]
                  action: [(C {(wd-post-session)} {(/refresh)})]
                  spids: [187 188 195 16777215]
                )
                (case_arm
                  pat_list: [{(get-current-url)}]
                  action: [(C {(wd-get-current-url)})]
                  spids: [199 200 205 16777215]
                )
                (case_arm
                  pat_list: [{(get-title)}]
                  action: [(C {(wd-get-title)})]
                  spids: [208 209 214 16777215]
                )
                (case_arm
                  pat_list: [{(get-page-source)} {(page-source)}]
                  action: [(C {(wd-get-page-source)} {(DQ ($ VSub_At '$@'))})]
                  spids: [217 222 231 16777215]
                )
                (case_arm
                  pat_list: [{(get-window-handle)}]
                  action: [(C {(wd-get-window-handle)})]
                  spids: [235 236 241 16777215]
                )
                (case_arm
                  pat_list: [{(get-window-handles)}]
                  action: [(C {(wd-get-window-handles)})]
                  spids: [244 245 250 16777215]
                )
                (case_arm
                  pat_list: [{(switch-to-window)}]
                  action: [(C {(wd-switch-to-window)} {(DQ ($ VSub_At '$@'))})]
                  spids: [254 255 264 16777215]
                )
                (case_arm
                  pat_list: [{(switch-to-frame)}]
                  action: [(C {(wd-switch-to-frame)} {(DQ ($ VSub_At '$@'))})]
                  spids: [267 268 277 16777215]
                )
                (case_arm
                  pat_list: [{(switch-to-parent-frame)}]
                  action: [(C {(wd-post-session)} {(/frame/parent)})]
                  spids: [280 281 288 16777215]
                )
                (case_arm
                  pat_list: [{(get-window-size)}]
                  action: [(C {(wd-get-window-size)})]
                  spids: [292 293 298 16777215]
                )
                (case_arm
                  pat_list: [{(set-window-size)}]
                  action: [(C {(wd-set-window-size)} {(DQ ($ VSub_At '$@'))})]
                  spids: [301 302 311 16777215]
                )
                (case_arm
                  pat_list: [{(maximize)}]
                  action: [(C {(wd-maximize)})]
                  spids: [314 315 320 16777215]
                )
                (case_arm
                  pat_list: [{(find-element)} {(find)}]
                  action: [(C {(wd-find-element)} {(DQ ($ VSub_At '$@'))})]
                  spids: [324 329 338 16777215]
                )
                (case_arm
                  pat_list: [{(find-elements)} {(find-all)}]
                  action: [(C {(wd-find-elements)} {(DQ ($ VSub_At '$@'))})]
                  spids: [341 346 355 16777215]
                )
                (case_arm
                  pat_list: [{(find-element-in)} {(find-in)} {(find-element-from-element)}]
                  action: [(C {(wd-find-element-from-element)} {(DQ ($ VSub_At '$@'))})]
                  spids: [358 367 376 16777215]
                )
                (case_arm
                  pat_list: [{(find-elements-in)} {(find-all-in)} {(find-elements-from-element)}]
                  action: [(C {(wd-find-elements-from-element)} {(DQ ($ VSub_At '$@'))})]
                  spids: [379 388 397 16777215]
                )
                (case_arm
                  pat_list: [{(get-element-attribute)} {(attr)} {(attribute)}]
                  action: [(C {(wd-get-element-attribute)} {(DQ ($ VSub_At '$@'))})]
                  spids: [401 410 419 16777215]
                )
                (case_arm
                  pat_list: [{(get-element-css-value)} {(css-value)}]
                  action: [(C {(wd-get-element-css-value)} {(DQ ($ VSub_At '$@'))})]
                  spids: [422 427 436 16777215]
                )
                (case_arm
                  pat_list: [{(get-element-text)} {(text)}]
                  action: [(C {(wd-get-element-text)} {(DQ ($ VSub_At '$@'))})]
                  spids: [439 444 453 16777215]
                )
                (case_arm
                  pat_list: [{(get-element-tag-name)} {(tag-name)}]
                  action: [(C {(wd-get-element-tag-name)} {(DQ ($ VSub_At '$@'))})]
                  spids: [456 461 470 16777215]
                )
                (case_arm
                  pat_list: [{(is-element-selected)} {(is-selected)}]
                  action: [(C {(wd-is-element-selected)} {(DQ ($ VSub_At '$@'))})]
                  spids: [474 479 488 16777215]
                )
                (case_arm
                  pat_list: [{(is-element-enabled)} {(is-enabled)}]
                  action: [(C {(wd-is-element-enabled)} {(DQ ($ VSub_At '$@'))})]
                  spids: [491 496 505 16777215]
                )
                (case_arm
                  pat_list: [{(element-click)} {(click)}]
                  action: [(C {(wd-element-click)} {(DQ ($ VSub_At '$@'))})]
                  spids: [509 514 523 16777215]
                )
                (case_arm
                  pat_list: [{(element-clear)} {(clear)}]
                  action: [(C {(wd-element-clear)} {(DQ ($ VSub_At '$@'))})]
                  spids: [526 531 540 16777215]
                )
                (case_arm
                  pat_list: [{(element-send-keys)} {(send-keys)}]
                  action: [(C {(wd-element-send-keys)} {(DQ ($ VSub_At '$@'))})]
                  spids: [543 548 557 16777215]
                )
                (case_arm
                  pat_list: [{(execute-script)} {(execute)} {(exec)}]
                  action: [(C {(wd-execute-script-sync)} {(DQ ($ VSub_At '$@'))})]
                  spids: [561 570 579 16777215]
                )
                (case_arm
                  pat_list: [{(execute-script-async)} {(execute-async)} {(exec-async)}]
                  action: [(C {(wd-execute-script-async)} {(DQ ($ VSub_At '$@'))})]
                  spids: [582 591 600 16777215]
                )
                (case_arm
                  pat_list: [{(get-all-cookies)} {(cookies)}]
                  action: [(C {(wd-get-all-cookies)})]
                  spids: [604 609 614 16777215]
                )
                (case_arm
                  pat_list: [{(get-named-cookie)} {(cookie)}]
                  action: [(C {(wd-get-named-cookie)} {(DQ ($ VSub_At '$@'))})]
                  spids: [617 622 631 16777215]
                )
                (case_arm
                  pat_list: [{(add-cookie)}]
                  action: [(C {(wd-add-cookie)} {(DQ ($ VSub_At '$@'))})]
                  spids: [634 635 644 16777215]
                )
                (case_arm
                  pat_list: [{(delete-cookie)}]
                  action: [(C {(wd-delete-cookie)} {(DQ ($ VSub_At '$@'))})]
                  spids: [647 648 657 16777215]
                )
                (case_arm
                  pat_list: [{(delete-cookies)}]
                  action: [(C {(wd-delete-cookies)})]
                  spids: [660 661 666 16777215]
                )
                (case_arm
                  pat_list: [{(take-screenshot)} {(screenshot)}]
                  action: [(C {(wd-take-screenshot)})]
                  spids: [670 675 680 16777215]
                )
                (case_arm
                  pat_list: [{(take-element-screenshot)} {(element-screenshot)}]
                  action: [(C {(wd-take-element-screenshot)} {(DQ ($ VSub_At '$@'))})]
                  spids: [683 688 697 16777215]
                )
                (case_arm
                  pat_list: [{(help)}]
                  action: [(C {(print-help)})]
                  spids: [701 702 707 16777215]
                )
                (case_arm
                  pat_list: [{(Lit_Other '*')}]
                  action: [
                    (SimpleCommand
                      words: [{(cat)}]
                      redirects: [
                        (Redir
                          op_id: Redir_GreatAnd
                          fd: 16777215
                          arg_word: {(2)}
                          spids: [717]
                        )
                        (HereDoc
                          op_id: Redir_DLess
                          fd: 16777215
                          body: {(DQ ('Usage: wd <command> [arguments]\n') ('Help:  wd help\n'))}
                          do_expansion: True
                          here_end: .
                          was_filled: T
                          spids: [720]
                        )
                      ]
                    )
                    (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
                  ]
                  spids: [711 712 732 16777215]
                )
              ]
              spids: [126 130 735]
            )
          ]
          spids: [97]
        )
      spids: [93 96]
    )
    (FuncDef
      name: die
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:rc)
                      op: Equal
                      rhs: {($ VSub_Number '$1')}
                      spids: [747]
                    )
                  ]
                  spids: [747]
                )
              terminator: <Op_Semi ';'>
            )
            (Sentence child:(C {(shift)}) terminator:<Op_Semi ';'>)
            (Sentence
              child: 
                (SimpleCommand
                  words: [{(echo)} {(DQ ($ VSub_Number '$0') (':'))} {(DQ ($ VSub_At '$@'))}]
                  redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[765])]
                )
              terminator: <Op_Semi ';'>
            )
            (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(DQ ($ VSub_Name '$rc'))})
          ]
          spids: [744]
        )
      spids: [740 743]
    )
    (FuncDef
      name: json-obj
      body: 
        (BraceGroup
          children: [
            (C {(perl)} {(-mJSON) (Lit_Other ':') (Lit_Other ':') (PP)} {(-e)} 
              {
                (SQ <'\n'> <'    use List::Util qw(pairmap);\n'> 
                  <'    $j = JSON::PP->new->allow_nonref;\n'> <'    print "{", join(",", pairmap { $j->encode($a) .":". $b } @ARGV), "}"\n'> <'  '>
                )
              } {(DQ ($ VSub_At '$@'))}
            )
          ]
          spids: [782]
        )
      spids: [778 781]
    )
    (FuncDef
      name: json-arr
      body: 
        (BraceGroup
          children: [
            (C {(perl)} {(-e)} {(SQ <'\n'> <'    print "[", join(",", @ARGV), "]"\n'> <'  '>)} 
              {(DQ ($ VSub_At '$@'))}
            )
          ]
          spids: [813]
        )
      spids: [809 812]
    )
    (FuncDef
      name: json-str
      body: 
        (BraceGroup
          children: [
            (C {(perl)} {(-mJSON) (Lit_Other ':') (Lit_Other ':') (PP)} {(-e)} 
              {(SQ <'print JSON::PP->new->allow_nonref->encode($ARGV[0])'>)} {(DQ ($ VSub_Number '$1'))}
            )
          ]
          spids: [837]
        )
      spids: [833 836]
    )
    (FuncDef
      name: json-get
      body: 
        (BraceGroup
          children: [
            (C {(perl)} {(-mJSON) (Lit_Other ':') (Lit_Other ':') (PP)} {(-e)} 
              {
                (SQ <'\n'> <'    local $/; my $s = <STDIN> || exit 1;\n'> 
                  <'    my $j = JSON::PP->new->allow_nonref;\n'> <'    my $data = $j->decode($s);\n'> <'    my $x = $data;\n'> <'    foreach (@ARGV) {\n'> 
                  <'      if (ref($x) eq "ARRAY") {\n'> <'        # convert array to k=>v hash\n'> <'        my %h = map { $_ => $x->[$_] } 0..$#$x;\n'> 
                  <'        $x = \\%h;\n'> <'      }\n'> <'      exists $x->{$_} or die "invalid JSON index";\n'> <'      $x = $x->{$_};\n'> 
                  <'    }\n'> <'    print $j->encode($x), "\\n";\n'> <'  '>
                )
              } {(DQ ($ VSub_At '$@'))}
            )
          ]
          spids: [864]
        )
      spids: [860 863]
    )
    (FuncDef
      name: json-raw
      body: 
        (BraceGroup
          children: [
            (C {(perl)} {(-mJSON) (Lit_Other ':') (Lit_Other ':') (PP)} {(-e)} 
              {
                (SQ <'\n'> <'    local $/; my $s = <STDIN> || exit 1;\n'> 
                  <'    my $j = JSON::PP->new->allow_nonref;\n'> <'    sub flat {\n'> <'      my $x = shift;\n'> <'      if (ref($x) eq "ARRAY") {\n'> 
                  <'        flat($_) foreach @$x;\n'> <'      } elsif (ref($x) eq "HASH") {\n'> <'        flat($_) foreach values %$x;\n'> 
                  <'      } else {\n'> <'        print $x, "\\n";\n'> <'      }\n'> <'    }\n'> <'    flat $j->decode($s);\n'> <'  '>
                )
              }
            )
          ]
          spids: [906]
        )
      spids: [902 905]
    )
    (FuncDef
      name: json-raw-nonnull
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:x) op:Equal spids:[948])]
              spids: [946]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:x)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: (CommandList children:[(C {(cat)})])
                        left_token: <Left_CommandSub '$('>
                        spids: [952 954]
                      )
                    }
                  spids: [951]
                )
              ]
              spids: [951]
            )
            (Case
              to_match: {($ VSub_Name '$x')}
              arms: [
                (case_arm
                  pat_list: [{(null)}]
                  action: [(C {(false)})]
                  spids: [964 965 969 16777215]
                )
                (case_arm
                  pat_list: [{(Lit_Other '*')}]
                  action: [
                    (SimpleCommand
                      words: [{(json-raw)}]
                      redirects: [
                        (Redir
                          op_id: Redir_TLess
                          fd: 16777215
                          arg_word: {(DQ ($ VSub_Name '$x'))}
                          spids: [977]
                        )
                      ]
                    )
                  ]
                  spids: [972 973 982 16777215]
                )
              ]
              spids: [957 961 985]
            )
          ]
          spids: [943]
        )
      spids: [939 942]
    )
    (FuncDef
      name: json-get-raw
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (Pipeline
                  children: [(C {(json-get)} {(DQ ($ VSub_At '$@'))}) (C {(json-raw)})]
                  negated: F
                )
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [994]
        )
      spids: [990 993]
    )
    (FuncDef
      name: json-get-raw-nonnull
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (Pipeline
                  children: [(C {(json-get)} {(DQ ($ VSub_At '$@'))}) (C {(json-raw-nonnull)})]
                  negated: F
                )
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [1013]
        )
      spids: [1009 1012]
    )
    (FuncDef
      name: decode-base64
      body: 
        (BraceGroup
          children: [
            (C {(perl)} {(-MMIME) (Lit_Other ':') (Lit_Other ':') (Base64)} {(-e)} 
              {(SQ <'print decode_base64(<STDIN>)'>)}
            )
          ]
          spids: [1033]
        )
      spids: [1029 1032]
    )
    (FuncDef
      name: hush
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (SimpleCommand
                  words: [{(DQ ($ VSub_At '$@'))}]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: 16777215
                      arg_word: {(/dev/null)}
                      spids: [1062]
                    )
                  ]
                )
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [1056]
        )
      spids: [1052 1055]
    )
    (FuncDef
      name: wd-post
      body: 
        (BraceGroup
          children: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: (BoolBinary op_id:BoolBinary_eq left:{($ VSub_Pound '$#')} right:{(2)})
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(curl)} {(-sSL)} {(-H)} {(DQ ('Content-Type: application/json'))} {(--data-raw)} 
                      {(DQ ($ VSub_Number '$2'))} {(DQ ($ VSub_Name '$WEBDRIVER_URL')) (DQ ($ VSub_Number '$1'))}
                    )
                  ]
                  spids: [16777215 1089]
                )
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: (BoolBinary op_id:BoolBinary_eq left:{($ VSub_Pound '$#')} right:{(1)})
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(curl)} {(-sSL)} {(-XPOST)} 
                      {(DQ ($ VSub_Name '$WEBDRIVER_URL')) (DQ ($ VSub_Number '$1'))}
                    )
                  ]
                  spids: [1118 1131]
                )
              ]
              else_action: [(C {(die)} {(127)} {(internal)} {(error)})]
              spids: [1148 1160]
            )
          ]
          spids: [1073]
        )
      spids: [1069 1072]
    )
    (FuncDef
      name: wd-new-session
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:capabilities) op:Equal spids:[1174])]
              spids: [1172]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolUnary
                              op_id: BoolUnary_n
                              child: {(DQ ($ VSub_Name '$WEBDRIVER_CAPABILITIES'))}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:capabilities)
                          op: Equal
                          rhs: {(DQ ($ VSub_Name '$WEBDRIVER_CAPABILITIES'))}
                          spids: [1193]
                        )
                      ]
                      spids: [1193]
                    )
                  ]
                  spids: [16777215 1190]
                )
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolUnary
                              op_id: BoolUnary_n
                              child: {(DQ ($ VSub_Name '$WEBDRIVER_BROWSER'))}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:capabilities)
                          op: Equal
                          rhs: 
                            {
                              (DQ 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [
                                        (C {(json-obj)} {(browserName)} 
                                          {
                                            (DQ 
                                              (CommandSubPart
                                                command_list: 
                                                  (CommandList
                                                    children: [
                                                      (C {(json-str)} 
                                                        {(DQ ($ VSub_Name '$WEBDRIVER_BROWSER'))}
                                                      )
                                                    ]
                                                  )
                                                left_token: <Left_CommandSub '$('>
                                                spids: [1223 1229]
                                              )
                                            )
                                          }
                                        )
                                      ]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [1217 1231]
                                )
                              )
                            }
                          spids: [1215]
                        )
                      ]
                      spids: [1215]
                    )
                  ]
                  spids: [1199 1212]
                )
              ]
              else_action: [
                (C {(die)} {(1)} {(DQ ('neither WEBDRIVER_CAPABILITIES nor WEBDRIVER_BROWSER set'))})
              ]
              spids: [1235 1247]
            )
            (Pipeline
              children: [
                (C {(wd-post)} {(/session)} 
                  {
                    (DQ 
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (C {(json-obj)} {(desiredCapabilities)} 
                                {(DQ ($ VSub_Name '$capabilities'))}
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [1255 1263]
                      )
                    )
                  }
                )
                (C {(json-get-raw-nonnull)} {(sessionId)})
              ]
              negated: F
            )
          ]
          spids: [1169]
        )
      spids: [1165 1168]
    )
    (FuncDef
      name: wd-assert-session
      body: 
        (BraceGroup
          children: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolUnary
                              op_id: BoolUnary_z
                              child: {(DQ ($ VSub_Name '$WEBDRIVER_SESSION'))}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(die)} {(1)} {(WEBDRIVER_SESSION)} {(not)} {(defined)})]
                  spids: [16777215 1296]
                )
              ]
              spids: [16777215 1310]
            )
          ]
          spids: [1280]
        )
      spids: [1276 1279]
    )
    (FuncDef
      name: wd-get-session
      body: 
        (BraceGroup
          children: [
            (C {(wd-assert-session)})
            (C {(curl)} {(-sSL)} 
              {(DQ ($ VSub_Name '$WEBDRIVER_URL')) (/session/) (DQ ($ VSub_Name '$WEBDRIVER_SESSION')) 
                (DQ ($ VSub_Number '$1'))
              }
            )
          ]
          spids: [1319]
        )
      spids: [1315 1318]
    )
    (FuncDef
      name: wd-checked-result
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:result) op:Equal spids:[1352])]
              spids: [1350]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:result)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: (CommandList children:[(C {(cat)})])
                        left_token: <Left_CommandSub '$('>
                        spids: [1356 1358]
                      )
                    }
                  spids: [1355]
                )
              ]
              spids: [1355]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:status)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (CommandSubPart
                          command_list: 
                            (CommandList
                              children: [
                                (SimpleCommand
                                  words: [{(json-get)} {(status)}]
                                  redirects: [
                                    (Redir
                                      op_id: Redir_TLess
                                      fd: 16777215
                                      arg_word: {(DQ ($ VSub_Name '$result'))}
                                      spids: [1368]
                                    )
                                  ]
                                )
                              ]
                            )
                          left_token: <Left_CommandSub '$('>
                          spids: [1363 1372]
                        )
                      )
                    }
                  spids: [1361]
                )
              ]
              spids: [1361]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_ne
                              left: {($ VSub_Name '$status')}
                              right: {(0)}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(die)} {(1)} 
                      {
                        (DQ 
                          (CommandSubPart
                            command_list: 
                              (CommandList
                                children: [
                                  (SimpleCommand
                                    words: [{(json-get-raw)} {(value)} {(message)}]
                                    redirects: [
                                      (Redir
                                        op_id: Redir_TLess
                                        fd: 16777215
                                        arg_word: {(DQ ($ VSub_Name '$result'))}
                                        spids: [1404]
                                      )
                                    ]
                                  )
                                ]
                              )
                            left_token: <Left_CommandSub '$('>
                            spids: [1397 1408]
                          )
                        )
                      }
                    )
                  ]
                  spids: [16777215 1389]
                )
              ]
              else_action: [
                (SimpleCommand
                  words: [{(json-get)} {(value)}]
                  redirects: [
                    (Redir
                      op_id: Redir_TLess
                      fd: 16777215
                      arg_word: {(DQ ($ VSub_Name '$result'))}
                      spids: [1419]
                    )
                  ]
                )
              ]
              spids: [1412 1425]
            )
          ]
          spids: [1347]
        )
      spids: [1343 1346]
    )
    (FuncDef
      name: wd-post-session-value
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (Pipeline
                  children: [(C {(wd-post-session)} {(DQ ($ VSub_At '$@'))}) (C {(wd-checked-result)})]
                  negated: F
                )
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [1434]
        )
      spids: [1430 1433]
    )
    (FuncDef
      name: wd-get-session-simple
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (Pipeline
                  children: [
                    (C {(wd-get-session)} {(DQ ($ VSub_At '$@'))})
                    (C {(json-get-raw-nonnull)} {(value)})
                  ]
                  negated: F
                )
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [1453]
        )
      spids: [1449 1452]
    )
    (FuncDef
      name: wd-get-session-value
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (Pipeline
                  children: [(C {(wd-get-session)} {(DQ ($ VSub_At '$@'))}) (C {(wd-checked-result)})]
                  negated: F
                )
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [1474]
        )
      spids: [1470 1473]
    )
    (FuncDef
      name: wd-get-session-value-raw
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (Pipeline
                  children: [
                    (C {(wd-get-session-value)} {(DQ ($ VSub_At '$@'))})
                    (C {(json-raw-nonnull)})
                  ]
                  negated: F
                )
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [1493]
        )
      spids: [1489 1492]
    )
    (FuncDef
      name: wd-get-element-value
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (C {(wd-get-session-value-raw)} 
                  {(/element/) (DQ ($ VSub_Number '$1')) (/) (DQ ($ VSub_Number '$2'))}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [1512]
        )
      spids: [1508 1511]
    )
    (FuncDef
      name: wd-get-current-url
      body: 
        (BraceGroup
          children: [(Sentence child:(C {(wd-get-session-simple)} {(/url)}) terminator:<Op_Semi ';'>)]
          spids: [1533]
        )
      spids: [1529 1532]
    )
    (FuncDef
      name: wd-get-title
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: (C {(wd-get-session-simple)} {(/title)})
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [1546]
        )
      spids: [1542 1545]
    )
    (FuncDef
      name: wd-get-window-handle
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: (C {(wd-get-session-simple)} {(/window)})
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [1559]
        )
      spids: [1555 1558]
    )
    (FuncDef
      name: wd-get-page-source
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (Pipeline
                  children: [(C {(wd-get-session-value)} {(/source)}) (C {(json-raw)})]
                  negated: F
                )
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [1572]
        )
      spids: [1568 1571]
    )
    (FuncDef
      name: wd-delete-session
      body: 
        (BraceGroup
          children: [
            (C {(wd-assert-session)})
            (C {(curl)} {(-sSL)} {(-XDELETE)} 
              {(DQ ($ VSub_Name '$WEBDRIVER_URL')) (/session/) (DQ ($ VSub_Name '$WEBDRIVER_SESSION')) 
                (DQ ($ VSub_Number '$1'))
              }
            )
          ]
          spids: [1590]
        )
      spids: [1586 1589]
    )
    (FuncDef
      name: wd-post-session
      body: 
        (BraceGroup
          children: [
            (C {(wd-assert-session)})
            (Sentence
              child: 
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:url)
                      op: Equal
                      rhs: {($ VSub_Number '$1')}
                      spids: [1626]
                    )
                  ]
                  spids: [1626]
                )
              terminator: <Op_Semi ';'>
            )
            (C {(shift)})
            (Pipeline
              children: [
                (C {(wd-post)} 
                  {(/session/) (DQ ($ VSub_Name '$WEBDRIVER_SESSION')) (DQ ($ VSub_Name '$url'))} {(DQ ($ VSub_At '$@'))}
                )
                (C {(wd-checked-result)})
              ]
              negated: F
            )
          ]
          spids: [1620]
        )
      spids: [1616 1619]
    )
    (FuncDef
      name: wd-go
      body: 
        (BraceGroup
          children: [
            (C {(hush)} {(wd-post-session)} {(/url)} 
              {
                (DQ 
                  (CommandSubPart
                    command_list: 
                      (CommandList
                        children: [
                          (C {(json-obj)} {(url)} 
                            {
                              (DQ 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [(C {(json-str)} {(DQ ($ VSub_Number '$1'))})]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [1674 1680]
                                )
                              )
                            }
                          )
                        ]
                      )
                    left_token: <Left_CommandSub '$('>
                    spids: [1668 1682]
                  )
                )
              }
            )
          ]
          spids: [1658]
        )
      spids: [1654 1657]
    )
    (FuncDef
      name: wd-close-window
      body: (BraceGroup children:[(C {(hush)} {(wd-delete-session)} {(/window)})] spids:[1692])
      spids: [1688 1691]
    )
    (FuncDef
      name: wd-switch-to-window
      body: 
        (BraceGroup
          children: [
            (C {(hush)} {(wd-post-session)} {(/window)} 
              {
                (DQ 
                  (CommandSubPart
                    command_list: 
                      (CommandList
                        children: [
                          (C {(json-obj)} {(handle)} 
                            {
                              (DQ 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [(C {(json-str)} {(DQ ($ VSub_Number '$1'))})]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [1724 1730]
                                )
                              )
                            }
                          )
                        ]
                      )
                    left_token: <Left_CommandSub '$('>
                    spids: [1718 1732]
                  )
                )
              }
            )
          ]
          spids: [1708]
        )
      spids: [1704 1707]
    )
    (FuncDef
      name: wd-get-window-handles
      body: 
        (BraceGroup
          children: [
            (Pipeline
              children: [(C {(wd-get-session)} {(/window/handles)}) (C {(json-get-raw)} {(value)})]
              negated: F
            )
          ]
          spids: [1742]
        )
      spids: [1738 1741]
    )
    (FuncDef
      name: wd-switch-to-frame
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:id) op:Equal spids:[1767])]
              spids: [1765]
            )
            (Case
              to_match: {($ VSub_Number '$1')}
              arms: [
                (case_arm
                  pat_list: [{(Lit_Other '[') (0-9) (Lit_Other ']')}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:id)
                          op: Equal
                          rhs: {($ VSub_Number '$1')}
                          spids: [1783]
                        )
                      ]
                      spids: [1783]
                    )
                  ]
                  spids: [1777 1781 1786 16777215]
                )
                (case_arm
                  pat_list: [{(Lit_Other '*')}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:id)
                          op: Equal
                          rhs: 
                            {
                              (DQ 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [(C {(json-str)} {(DQ ($ VSub_Number '$1'))})]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [1795 1801]
                                )
                              )
                            }
                          spids: [1793]
                        )
                      ]
                      spids: [1793]
                    )
                  ]
                  spids: [1789 1791 1804 16777215]
                )
              ]
              spids: [1770 1774 1807]
            )
            (C {(hush)} {(wd-post-session)} {(/frame)} 
              {
                (DQ 
                  (CommandSubPart
                    command_list: 
                      (CommandList
                        children: [(C {(json-obj)} {(id)} {(DQ ($ VSub_Name '$id'))})]
                      )
                    left_token: <Left_CommandSub '$('>
                    spids: [1817 1825]
                  )
                )
              }
            )
          ]
          spids: [1762]
        )
      spids: [1758 1761]
    )
    (FuncDef
      name: wd-switch-to-top-level-frame
      body: 
        (BraceGroup
          children: [
            (C {(hush)} {(wd-post-session)} {(frame)} 
              {
                (DQ 
                  (CommandSubPart
                    command_list: (CommandList children:[(C {(json-obj)} {(id)} {(null)})])
                    left_token: <Left_CommandSub '$('>
                    spids: [1845 1851]
                  )
                )
              }
            )
          ]
          spids: [1835]
        )
      spids: [1831 1834]
    )
    (FuncDef
      name: wd-get-window-size
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:result) op:Equal spids:[1866])]
              spids: [1864]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:result)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [(C {(wd-get-session)} {(/window/size)})]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [1870 1874]
                      )
                    }
                  spids: [1869]
                )
              ]
              spids: [1869]
            )
            (Pipeline
              children: [
                (C {(echo)} {(DQ ($ VSub_Name '$result'))})
                (C {(json-get-raw)} {(value)} {(width)})
              ]
              negated: F
            )
            (Pipeline
              children: [
                (C {(echo)} {(DQ ($ VSub_Name '$result'))})
                (C {(json-get-raw)} {(value)} {(height)})
              ]
              negated: F
            )
          ]
          spids: [1861]
        )
      spids: [1857 1860]
    )
    (FuncDef
      name: wd-set-window-size
      body: 
        (BraceGroup
          children: [
            (C {(hush)} {(wd-post-session)} {(/window/size)} 
              {
                (DQ 
                  (CommandSubPart
                    command_list: 
                      (CommandList
                        children: [
                          (C {(json-obj)} {(width)} {(DQ ($ VSub_Number '$1'))} {(height)} 
                            {(DQ ($ VSub_Number '$2'))}
                          )
                        ]
                      )
                    left_token: <Left_CommandSub '$('>
                    spids: [1923 1937]
                  )
                )
              }
            )
          ]
          spids: [1913]
        )
      spids: [1909 1912]
    )
    (FuncDef
      name: wd-maximize
      body: 
        (BraceGroup
          children: [(C {(hush)} {(wd-post-session)} {(/window/maximize)})]
          spids: [1947]
        )
      spids: [1943 1946]
    )
    (FuncDef
      name: wd-parse-strategy
      body: 
        (BraceGroup
          children: [
            (Case
              to_match: {($ VSub_Number '$1')}
              arms: [
                (case_arm
                  pat_list: [{(id)}]
                  action: [(C {(json-str)} {(DQ (id))})]
                  spids: [1973 1974 1982 16777215]
                )
                (case_arm
                  pat_list: [{(name)}]
                  action: [(C {(json-str)} {(DQ (name))})]
                  spids: [1985 1986 1994 16777215]
                )
                (case_arm
                  pat_list: [{(class) (Lit_Other '*')}]
                  action: [(C {(json-str)} {(DQ ('class name'))})]
                  spids: [1997 1999 2007 16777215]
                )
                (case_arm
                  pat_list: [{(tag) (Lit_Other '*')}]
                  action: [(C {(json-str)} {(DQ ('tag name'))})]
                  spids: [2010 2012 2020 16777215]
                )
                (case_arm
                  pat_list: [{(css) (Lit_Other '*')}]
                  action: [(C {(json-str)} {(DQ ('css selector'))})]
                  spids: [2023 2025 2033 16777215]
                )
                (case_arm
                  pat_list: [{(link) (Lit_Other '*')}]
                  action: [(C {(json-str)} {(DQ ('link text'))})]
                  spids: [2036 2038 2046 16777215]
                )
                (case_arm
                  pat_list: [{(partial) (Lit_Other '*')}]
                  action: [(C {(json-str)} {(DQ ('partial link text'))})]
                  spids: [2049 2051 2059 16777215]
                )
                (case_arm
                  pat_list: [{(xpath) (Lit_Other '*')}]
                  action: [(C {(json-str)} {(xpath)})]
                  spids: [2062 2064 2070 16777215]
                )
                (case_arm
                  pat_list: [{(Lit_Other '*')}]
                  action: [
                    (C {(die)} {(1)} {(unknown)} {(element)} {(location)} {(strategy) (Lit_Other ':')} 
                      {(DQ ($ VSub_Number '$1'))}
                    )
                  ]
                  spids: [2073 2074 16777215 2094]
                )
              ]
              spids: [1966 1970 2094]
            )
          ]
          spids: [1963]
        )
      spids: [1959 1962]
    )
    (FuncDef
      name: wd-general-element-find
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (Assignment
                  keyword: Assign_Local
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:path)
                      op: Equal
                      rhs: {(DQ ($ VSub_Number '$1'))}
                      spids: [2108]
                    )
                  ]
                  spids: [2106]
                )
              terminator: <Op_Semi ';'>
            )
            (C {(shift)})
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:strategy) op:Equal spids:[2119])]
              spids: [2117]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:strategy)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (CommandSubPart
                          command_list: 
                            (CommandList
                              children: [(C {(wd-parse-strategy)} {(DQ ($ VSub_Number '$1'))})]
                            )
                          left_token: <Left_CommandSub '$('>
                          spids: [2124 2130]
                        )
                      )
                    }
                  spids: [2122]
                )
              ]
              spids: [2122]
            )
            (AndOr
              ops: [Op_DPipe]
              children: [
                (DBracket
                  expr: (BoolBinary op_id:BoolBinary_eq left:{($ VSub_QMark '$?')} right:{(0)})
                )
                (ControlFlow
                  token: <ControlFlow_Exit exit>
                  arg_word: {($ VSub_QMark '$?')}
                )
              ]
            )
            (C {(shift)})
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:value) op:Equal spids:[2156])]
              spids: [2154]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:value)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [(C {(json-str)} {(DQ ($ VSub_Star '$*'))})]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [2160 2166]
                      )
                    }
                  spids: [2159]
                )
              ]
              spids: [2159]
            )
            (Pipeline
              children: [
                (C {(wd-post-session)} {(DQ ($ VSub_Name '$path'))} 
                  {
                    (DQ 
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (C {(json-obj)} {(using)} {(DQ ($ VSub_Name '$strategy'))} {(value)} 
                                {(DQ ($ VSub_Name '$value'))}
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [2176 2190]
                      )
                    )
                  }
                )
                (C {(json-raw)})
              ]
              negated: F
            )
          ]
          spids: [2103]
        )
      spids: [2099 2102]
    )
    (FuncDef
      name: wd-find-element
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: (C {(wd-general-element-find)} {(/element)} {(DQ ($ VSub_At '$@'))})
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [2205]
        )
      spids: [2201 2204]
    )
    (FuncDef
      name: wd-find-elements
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: (C {(wd-general-element-find)} {(/elements)} {(DQ ($ VSub_At '$@'))})
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [2222]
        )
      spids: [2218 2221]
    )
    (FuncDef
      name: wd-find-element-from-element
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (Assignment
                  keyword: Assign_Local
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:element)
                      op: Equal
                      rhs: {($ VSub_Number '$1')}
                      spids: [2245]
                    )
                  ]
                  spids: [2243]
                )
              terminator: <Op_Semi ';'>
            )
            (C {(shift)})
            (C {(wd-general-element-find)} {(/element/) (DQ ($ VSub_Name '$element')) (/element)} 
              {(DQ ($ VSub_At '$@'))}
            )
          ]
          spids: [2240]
        )
      spids: [2236 2239]
    )
    (FuncDef
      name: wd-find-elements-from-element
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (Assignment
                  keyword: Assign_Local
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:element)
                      op: Equal
                      rhs: {($ VSub_Number '$1')}
                      spids: [2276]
                    )
                  ]
                  spids: [2274]
                )
              terminator: <Op_Semi ';'>
            )
            (C {(shift)})
            (C {(wd-general-element-find)} {(/element/) (DQ ($ VSub_Name '$element')) (/elements)} 
              {(DQ ($ VSub_At '$@'))}
            )
          ]
          spids: [2271]
        )
      spids: [2267 2270]
    )
    (FuncDef
      name: wd-get-element-attribute
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:x) op:Equal spids:[2307])]
              spids: [2305]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:x)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (C {(wd-get-session-value-raw)} 
                                {(/element/) (DQ ($ VSub_Number '$1')) (/attribute/) 
                                  (DQ ($ VSub_Number '$2'))
                                }
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [2311 2322]
                      )
                    }
                  spids: [2310]
                )
              ]
              spids: [2310]
            )
            (AndOr
              ops: [Op_DPipe]
              children: [
                (DBracket
                  expr: (BoolBinary op_id:BoolBinary_eq left:{($ VSub_QMark '$?')} right:{(0)})
                )
                (C {(die)} {(1)} {(DQ ('attribute not found'))})
              ]
            )
            (C {(echo)} {(DQ ($ VSub_Name '$x'))})
          ]
          spids: [2302]
        )
      spids: [2298 2301]
    )
    (FuncDef
      name: wd-get-element-css-value
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:x) op:Equal spids:[2364])]
              spids: [2362]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:x)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (C {(wd-get-session-value-raw)} 
                                {(/element/) (DQ ($ VSub_Number '$1')) (/css/) 
                                  (DQ ($ VSub_Number '$2'))
                                }
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [2368 2379]
                      )
                    }
                  spids: [2367]
                )
              ]
              spids: [2367]
            )
            (AndOr
              ops: [Op_DPipe]
              children: [
                (DBracket
                  expr: (BoolBinary op_id:BoolBinary_eq left:{($ VSub_QMark '$?')} right:{(0)})
                )
                (C {(die)} {(1)} {(DQ ('CSS property not found'))})
              ]
            )
            (C {(echo)} {(DQ ($ VSub_Name '$x'))})
          ]
          spids: [2359]
        )
      spids: [2355 2358]
    )
    (FuncDef
      name: wd-get-element-text
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: (C {(wd-get-element-value)} {(DQ ($ VSub_Number '$1'))} {(text)})
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [2416]
        )
      spids: [2412 2415]
    )
    (FuncDef
      name: wd-get-element-tag-name
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: (C {(wd-get-element-value)} {(DQ ($ VSub_Number '$1'))} {(name)})
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [2433]
        )
      spids: [2429 2432]
    )
    (FuncDef
      name: wd-is-element-enabled
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolBinary
                      op_id: BoolBinary_eq
                      left: {(1)}
                      right: 
                        {
                          (CommandSubPart
                            command_list: 
                              (CommandList
                                children: [
                                  (C {(wd-get-element-value)} {(DQ ($ VSub_Number '$1'))} {(enabled)})
                                ]
                              )
                            left_token: <Left_CommandSub '$('>
                            spids: [2459 2467]
                          )
                        }
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [2451]
        )
      spids: [2447 2450]
    )
    (FuncDef
      name: wd-is-element-selected
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolBinary
                      op_id: BoolBinary_eq
                      left: {(1)}
                      right: 
                        {
                          (CommandSubPart
                            command_list: 
                              (CommandList
                                children: [
                                  (C {(wd-get-element-value)} {(DQ ($ VSub_Number '$1'))} {(selected)})
                                ]
                              )
                            left_token: <Left_CommandSub '$('>
                            spids: [2486 2494]
                          )
                        }
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [2478]
        )
      spids: [2474 2477]
    )
    (FuncDef
      name: wd-element-simple-action
      body: 
        (BraceGroup
          children: [
            (C {(hush)} {(wd-post-session)} 
              {(/element/) (DQ ($ VSub_Number '$1')) (/) (DQ ($ VSub_Number '$2'))}
            )
          ]
          spids: [2506]
        )
      spids: [2502 2505]
    )
    (FuncDef
      name: wd-element-click
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: (C {(wd-element-simple-action)} {(DQ ($ VSub_Number '$1'))} {(click)})
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [2529]
        )
      spids: [2525 2528]
    )
    (FuncDef
      name: wd-element-clear
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: (C {(wd-element-simple-action)} {(DQ ($ VSub_Number '$1'))} {(clear)})
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [2546]
        )
      spids: [2542 2545]
    )
    (FuncDef
      name: wd-element-send-keys
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:element) op:Equal spids:[2569])]
              spids: [2567]
            )
            (Sentence
              child: 
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:element)
                      op: Equal
                      rhs: {($ VSub_Number '$1')}
                      spids: [2572]
                    )
                  ]
                  spids: [2572]
                )
              terminator: <Op_Semi ';'>
            )
            (C {(shift)})
            (C {(wd-element-simple-action)} {(DQ ($ VSub_Name '$element'))} {(value)} 
              {
                (DQ 
                  (CommandSubPart
                    command_list: 
                      (CommandList
                        children: [
                          (C {(json-obj)} {(value)} 
                            {
                              (DQ 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [(C {(json-str)} {(DQ ($ VSub_Star '$*'))})]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [2594 2600]
                                )
                              )
                            }
                          )
                        ]
                      )
                    left_token: <Left_CommandSub '$('>
                    spids: [2588 2602]
                  )
                )
              }
            )
          ]
          spids: [2564]
        )
      spids: [2560 2563]
    )
    (FuncDef
      name: wd-execute-script-sync
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (Assignment
                  keyword: Assign_Local
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:script)
                      op: Equal
                      rhs: {(DQ ($ VSub_Number '$1'))}
                      spids: [2617]
                    )
                  ]
                  spids: [2615]
                )
              terminator: <Op_Semi ';'>
            )
            (C {(shift)})
            (C {(wd-post-session)} {(/execute/sync)} 
              {
                (DQ 
                  (CommandSubPart
                    command_list: 
                      (CommandList
                        children: [
                          (C {(json-obj)} {(script)} 
                            {
                              (DQ 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [(C {(json-str)} {(DQ ($ VSub_Name '$script'))})]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [2639 2645]
                                )
                              )
                            } {(args)} 
                            {
                              (DQ 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [(C {(json-arr)} {(DQ ($ VSub_At '$@'))})]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [2653 2659]
                                )
                              )
                            }
                          )
                        ]
                      )
                    left_token: <Left_CommandSub '$('>
                    spids: [2631 2664]
                  )
                )
              }
            )
          ]
          spids: [2612]
        )
      spids: [2608 2611]
    )
    (FuncDef
      name: wd-execute-script-async
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: 
                (Assignment
                  keyword: Assign_Local
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:script)
                      op: Equal
                      rhs: {(DQ ($ VSub_Number '$1'))}
                      spids: [2679]
                    )
                  ]
                  spids: [2677]
                )
              terminator: <Op_Semi ';'>
            )
            (C {(shift)})
            (C {(wd-post-session)} {(/execute/async)} 
              {
                (DQ 
                  (CommandSubPart
                    command_list: 
                      (CommandList
                        children: [
                          (C {(json-obj)} {(script)} 
                            {
                              (DQ 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [(C {(json-str)} {(DQ ($ VSub_Name '$script'))})]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [2701 2707]
                                )
                              )
                            } {(args)} 
                            {
                              (DQ 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [(C {(json-arr)} {(DQ ($ VSub_At '$@'))})]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [2715 2721]
                                )
                              )
                            }
                          )
                        ]
                      )
                    left_token: <Left_CommandSub '$('>
                    spids: [2693 2726]
                  )
                )
              }
            )
          ]
          spids: [2674]
        )
      spids: [2670 2673]
    )
    (FuncDef
      name: wd-get-all-cookies
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: (C {(wd-get-session-value)} {(/cookie)})
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [2736]
        )
      spids: [2732 2735]
    )
    (FuncDef
      name: wd-get-named-cookie
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: (C {(wd-get-session-value)} {(/cookie/) (DQ ($ VSub_Number '$1'))})
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [2749]
        )
      spids: [2745 2748]
    )
    (FuncDef
      name: wd-add-cookie
      body: 
        (BraceGroup
          children: [
            (C {(hush)} {(wd-post-session)} {(/cookie)} 
              {
                (DQ 
                  (CommandSubPart
                    command_list: 
                      (CommandList
                        children: [
                          (C {(json-obj)} {(cookie)} 
                            {
                              (DQ 
                                (CommandSubPart
                                  command_list: 
                                    (CommandList
                                      children: [(C {(json-obj)} {(DQ ($ VSub_At '$@'))})]
                                    )
                                  left_token: <Left_CommandSub '$('>
                                  spids: [2782 2788]
                                )
                              )
                            }
                          )
                        ]
                      )
                    left_token: <Left_CommandSub '$('>
                    spids: [2776 2790]
                  )
                )
              }
            )
          ]
          spids: [2766]
        )
      spids: [2762 2765]
    )
    (FuncDef
      name: wd-delete-cookie
      body: 
        (BraceGroup
          children: [
            (Sentence
              child: (C {(wd-delete-session)} {(/cookie/) (DQ ($ VSub_Number '$1'))})
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [2800]
        )
      spids: [2796 2799]
    )
    (FuncDef
      name: wd-delete-cookies
      body: 
        (BraceGroup
          children: [(Sentence child:(C {(wd-delete-session)} {(/cookie)}) terminator:<Op_Semi ';'>)]
          spids: [2816]
        )
      spids: [2812 2815]
    )
    (FuncDef
      name: wd-take-screenshot
      body: 
        (BraceGroup
          children: [
            (Pipeline
              children: [
                (C {(wd-get-session-value)} {(/screenshot)})
                (C {(json-raw)})
                (C {(decode-base64)})
              ]
              negated: F
            )
          ]
          spids: [2830]
        )
      spids: [2826 2829]
    )
    (FuncDef
      name: wd-take-element-screenshot
      body: 
        (BraceGroup
          children: [
            (Pipeline
              children: [
                (C {(wd-get-session-value)} {(/element/) (DQ ($ VSub_Number '$1')) (/screenshot)})
                (C {(json-raw)})
                (C {(decode-base64)})
              ]
              negated: F
            )
          ]
          spids: [2852]
        )
      spids: [2848 2851]
    )
    (FuncDef
      name: print-help
      body: 
        (BraceGroup
          children: [
            (SimpleCommand
              words: [{(cat)}]
              redirects: [
                (HereDoc
                  op_id: Redir_DLess
                  fd: 16777215
                  body: 
                    {('# wd -- WebDriver command line tool\n') ('\n') 
                      ('`wd` is a simple tool for interacting with servers that implement the\n') ('W3C WebDriver API.\n') ('\n') 
                      ('It can be used for web automation tasks such as testing and scraping.\n') ('\n') ('You can use [Selenium](http://www.seleniumhq.org/) as the WebDriver server\n') 
                      ('to control browsers on your own machine.\n') ('\n') ('There are commercial services that offer the WebDriver API remotely; see\n') 
                      (
'"Functional Test Services" [here](http://www.seleniumhq.org/ecosystem/).\n'
                      ) ('\n') ('See [the WebDriver spec](https://w3c.github.io/webdriver/webdriver-spec.html)\n') 
                      ('for details about the protocol and behavior.\n') ('\n') ('## Dependencies\n') ('\n') ('  - `bash`\n') ('  - `perl` (5.14 or greater)\n') ('  - `curl`\n') 
                      ('\n') ('## Example session\n') ('\n') ('    $ export WEBDRIVER_BROWSER=chrome\n') 
                      ('    $ export WEBDRIVER_SESSION="$(wd new-session)"\n') ('    $ wd go https://github.com/mbrock/wd\n') ('    $ wd screenshot > /tmp/wd.png\n') 
                      ('    $ wd click "$(wd find css .user-mention)"\n') ("    $ wd exec 'return document.title'\n") ('\n') ('## Configuration\n') ('\n') 
                      (
'  - `WEBDRIVER_URL`: WebDriver API URL (default `http://127.0.0.1:4444/wd/hub`)\n'
                      ) ('\n') ('## Command reference\n') ('\n') ('### Managing sessions\n') ('\n') ('#### `wd new-session`\n') 
                      ('\n') ('Prints the new session ID.\n') ('\n') 
                      ('All other commands expect this ID to be in `WEBDRIVER_SESSION`, so\n') ('\n') ('    export WEBDRIVER_SESSION="$(wd new-session)"\n') ('\n') ('is a useful pattern.\n') ('\n') 
                      ('You must configure desired capabilities by setting either\n') ('\n') ('  - `WEBDRIVER_CAPABILITIES` to a stringified JSON object, or\n') 
                      ('  - `WEBDRIVER_BROWSER` to a browser name (`chrome`, `firefox`, etc).\n') ('\n') ('#### `wd delete-session`\n') ('\n') ('Deletes the current session.\n') ('\n') 
                      ('### Navigation\n') ('\n') ('#### `wd go <url>`\n') ('\n') ('Opens `<url>` in the current window.\n') ('\n') 
                      ('#### `wd back`\n') ('\n') ('Navigates back in the current window.\n') ('\n') ('#### `wd forward`\n') ('\n') 
                      ('Navigates forward in the current window.\n') ('\n') ('#### `wd refresh`\n') ('\n') ('Refreshes the page of the current window.\n') ('\n') 
                      ('### Element finding\n') ('\n') ('#### `wd find <strategy> <selector> ...`\n') ('\n') 
                      ('Finds one matching element and prints its element ID.\n') ('\n') ('The `<strategy>` can be one of:\n') ('\n') ('  - `css` (CSS selector)\n') 
                      ('  - `xpath` (XPath selector)\n') ('  - `id` (element ID)\n') ('  - `name` (element name)\n') ('  - `class` (element class name)\n') 
                      ('  - `tag` (element tag name)\n') ('  - `link` (element link text)\n') ('  - `partial` (partial element link text)\n') ('\n') 
                      ('The `<selector>` values are concatenated for convenience.\n') ('\n') ('Example:\n') ('\n') ('    $ wd find css article header img.avatar\n') ('\n') 
                      ('#### `wd find-all <strategy> <selector> ...`\n') ('\n') ('See `wd find`; finds all matching elements.\n') ('\n') 
                      ('#### `wd find-in <element-id> <strategy> <selector> ...`\n') ('\n') ('See `wd find`; finds one matching sub-element.\n') ('\n') 
                      ('#### `wd find-all-in <element-id> <strategy> <selector> ...`\n') ('\n') ('See `wd find`; finds all matching sub-elements.\n') ('\n') ('### Element information\n') ('\n') 
                      ('#### `wd is-selected <element-id>`\n') ('\n') ('Exits with a non-zero status if the element is not a selected or\n') 
                      ('checked `input` or `option`.\n') ('\n') ('#### `wd is-enabled <element-id>`\n') ('\n') 
                      ('Exits with a non-zero status if the element is not an enabled\n') ('form control.\n') ('\n') ('#### `wd attribute <element-id> <attribute-name>`\n') ('\n') 
                      ('Prints an element attribute value.\n') ('\n') ('Exits with non-zero status if the given attribute does not exist.\n') ('\n') 
                      ('#### `wd css-value <element-id> <css-property-name>`\n') ('\n') ('Prints an element CSS property value.\n') ('\n') 
                      ('Exits with non-zero status if the given style property does not exist.\n') ('\n') ('#### `wd text <element-id>`\n') ('\n') ("Prints an element's `innerText`.\n") ('\n') 
                      ('#### `wd tag-name <element-id>`\n') ('\n') ('Prints the tag name of an element.\n') ('\n') ('### Element actions\n') ('\n') 
                      ('#### `wd click <element-id>`\n') ('\n') ('Clicks an element.\n') ('\n') ('#### `wd clear <element-id>`\n') ('\n') 
                      ('Clears the value, checkedness, or text content of an element.\n') ('\n') ('#### `wd send-keys <element-id> [keys] ...`\n') ('\n') ('Sends keys to an element.\n') ('\n') 
                      ('Key arguments are concatenated for convenience.\n') ('\n') ('Example:\n') ('\n') ('    $ wd send-keys "$(wd find id search)" webdriver json api\n') ('\n') 
                      ('### JavaScript execution\n') ('\n') ('#### `wd execute <body> [argument] ...`\n') ('\n') 
                      ('Evaluates the JavaScript code `<body>` as a function called with the\n') ('given arguments.\n') ('\n') ('Prints the return value of the specified function.\n') ('\n') 
                      ('#### `wd execute-async <body> [argument] ...`\n') ('\n') ('Evaluates as in `wd execute` but waiting for the script to invoke a callback\n') 
                      (
'which is passed as an additional final argument to the specified function.\n'
                      ) ('\n') ('Prints the value finally passed to the callback.\n') ('\n') ('### Page information\n') ('\n') 
                      ('#### `wd get-current-url`\n') ('\n') ('Prints the URL of the page in the current window.\n') ('\n') ('#### `wd get-title`\n') ('\n') 
                      ('Prints the title of the page in the current window.\n') ('\n') ('#### `wd get-page-source`\n') ('\n') 
                      ('Prints the raw HTML source of the page in the current window.\n') ('\n') ('### Windows\n') ('\n') ('#### `wd get-window-size`\n') ('\n') 
                      ("Prints the current window's width and height on separate lines.\n") ('\n') ('#### `wd set-window-size <width> <height>`\n') ('\n') 
                      ('Changes the size of the current window.\n') ('\n') ('#### `wd maximize`\n') ('\n') ('Maximizes the current window.\n') ('\n') 
                      ('#### `wd get-window-handle`\n') ('\n') ('Prints the window handle of the current window.\n') ('\n') ('#### `wd get-window-handles`\n') 
                      ('\n') ('Prints a list of all window handles in the current session.\n') ('\n') 
                      ('#### `wd switch-to-window <window-handle>`\n') ('\n') ('Changes which window is the current window.\n') ('\n') ('### Frames\n') ('\n') 
                      ('#### `wd switch-to-frame <frame-id>`\n') ('\n') ('Changes the current frame.\n') ('\n') 
                      ('`<frame-id>` can be either a number or an element ID.\n') ('\n') ('See [the specification](https://www.w3.org/TR/webdriver/#switch-to-frame)\n') 
                      ('for exact details.\n') ('\n') ('#### `wd switch-to-top-level-frame`\n') ('\n') ('Resets the current frame to the top level.\n') 
                      ('\n') ('#### `wd switch-to-parent-frame`\n') ('\n') 
                      ('Sets the current frame to the parent of the current frame.\n') ('\n') ('### Cookies\n') ('\n') 
                      (
'See [the spec](https://w3c.github.io/webdriver/webdriver-spec.html#cookies)\n'
                      ) ('for details on cookie JSON serialization.\n') ('\n') ('#### `wd cookies`\n') ('\n') 
                      ('Prints the currently set cookies as a JSON array.\n') ('\n') ('#### `wd cookie <name>`\n') ('\n') ('Prints the cookie named `<name>` as JSON.\n') ('\n') 
                      ('#### `wd add-cookie <key> <value> <key> <value> ...`\n') ('\n') ('Adds a cookie according to the given keys/values.\n') ('\n') 
                      ('Example: `wd add-cookie name \'"user"\' value \'"mbrock"\'`\n') ('\n') ('#### `wd delete-cookie <name>`\n') ('\n') ('Deletes the cookie whose name is `<name>`.\n') 
                      ('\n') ('#### `wd delete-cookies`\n') ('\n') ('Deletes all cookies.\n') ('\n') ('### Screenshots\n') ('\n') 
                      ('#### `wd screenshot`\n') ('\n') ('Prints a binary PNG screenshot to stdout.\n') ('\n') 
                      ('#### `wd element-screenshot <element-id>`\n') ('\n') ('Prints a binary PNG screenshot of a specific element to stdout.\n') ('\n') 
                      ('(Not supported by Chrome.)\n')
                    }
                  do_expansion: False
                  here_end: .
                  was_filled: T
                  spids: [2883]
                )
              ]
            )
          ]
          spids: [2878]
        )
      spids: [2874 2877]
    )
    (C {(main)} {(DQ ($ VSub_At '$@'))})
  ]
)