<commit_before>builder.selenium2.io.addLangFormatter({
    name : "Perl - WebDriver",
    extension : ".t",
    not : "! ",
    start : "#!perl\n\nuse strict;\nuse warnings;\nuse Test::More;\nuse Selenium::Remote::Driver;\n\nmy $wd = Selenium::Remote::Driver->new();\n",
    end : "\ndone_testing();\n",
    lineForType : {
        "get" : "ok( $wd->get({url}) );\n",
        "goBack" : "ok( $wd->go_back() );\n",
        "goForward" : "ok( $wd->go_forward() );\n",
        "refresh" : "ok( $wd->refresh() );\n",
        'clickElement' : "ok( $wd->find_element({locator}, {locatorBy})->click() );\n",
        "mouseOverElement":
            "ok( $wd->find_element({locator}, {locatorBy})->hover() );\n",
        "setElementText":
            "my $el = $wd->find_element({locator}, {locatorBy});\n" +
            "ok( $el->click() );\n" +
            "ok( $el->clear() );\n" +
            "ok( $el->send_keys({text}) );\n",
        "sendKeysToElement":
            "my $el = $wd->find_element({locator}, {locatorBy});\n" +
            "ok( $el->click() );\n" +
            "ok( $el->send_keys({text}) );\n",
        "setElementSelected":
            "my $el = $wd->find_element({locator}, {locatorBy});\n" +
            "if(! $el->is_selected()) {\nok( $el->click() );\n}",
        "setElementNotSelected":
            "my $el = $wd->find_element({locator}, {locatorBy});\n" +
            "if($el->is_selected()) {\nok( $el->click() );\n}",
        "submitElement":
          "ok( $wd->find_element({locator}, {locatorBy})->submit() );\n",
    },
    locatorByForType : function (stepType, locatorType, locatorIndex) {
        // Valid identifiers in Perl: class, class_name, css, id, link,
        // link_text, partial_link_text, tag_name, name or xpath.
        // Defaults to 'xpath'.
        return {
            "class"        : '"class"',
            "id"           : '"id"',
            "link text"    : '"link_text"',
            "xpath"        : '"xpath"',
            "css selector" : '"css"',
            "name"         : '"name"'
        }[locatorType];
    },
    assert : function (step, escapeValue, doSubs, getter) {
        if (step.negated) {
            return doSubs(
                "if ({getter} eq {cmp}) {\n" +
                "    die \"!{stepTypeName} failed\";\n" +
                "}\n", getter);
        } else {
            return doSubs(
                "if ({getter} ne {cmp}) {\n" +
                "    die \"!{stepTypeName} failed\";\n" +
                "}\n", getter);
        }
    },
    verify : function (step, escapeValue, doSubs, getter) {
        if (step.negated) {
            return doSubs(
                "if ({getter} eq {cmp}) {\n" +
                "    print \"!{stepTypeName} failed\";\n" +
                "}\n", getter);
        } else {
            return doSubs(
                "if ({getter} ne {cmp}) {\n" +
                "    print \"{stepTypeName} failed\";\n" +
                "}\n", getter);
        }
    },
    waitFor : "",
    store : "${{variable}} = {getter};\n",
    boolean_assert:
      "if ({posNot}{getter}) {\n" +
      " die (\"{negNot}{stepTypeName} failed\");\n" +
      "}\n",
    boolean_verify:
      "if ({posNot}{getter}) {\n" +
      " print \"{negNot}{stepTypeName} failed\";\n" +
      "}\n",
    boolean_waitFor: "",
    boolean_store:
      "${{variable}} = {getter};\n",
    // boolean_getters: {
    //   "TextPresent": {
    //     getter: "(strpos($wd->find_element(\"//html\", \"xpath\")->get_text(), {text}) ne false)",
    //     vartype: ""
    //   },
    //   "ElementPresent": {
    //     getter: "(strlen($wd->find_element({locator}, {locatorBy})) != 0)",
    //     vartype: ""
    //   },
    //   "ElementSelected": {
    //     getter: "($wd->find_element({locator}, {locatorBy})->is_selected())",
    //     vartype: ""
    //   },
    //   "CookiePresent": {
    //     getter: "($wd->getAllCookie({name}))",
    //     vartype: ""
    //   },
    //   "AlertPresent": {
    //     getter: "alert_present($wd)",
    //     vartype: ""
    //   }
    // },
    getters: {
      "BodyText": {
        getter: "$wd->find_element(\"//html\", \"xpath\")->get_text();",
        cmp: "{text}",
        vartype: ""
      },
      "PageSource": {
        getter: "$wd->get_page_source();",
        cmp: "{source}",
        vartype: ""
      },
      "Text": {
        getter: "$wd->find_element({locator}, {locatorBy})->get_text();",
        cmp: "{text}",
        vartype: ""
      },
      "CurrentUrl": {
        getter: "$wd->get_current_url();",
        cmp: "{url}",
        vartype: ""
      },
      "Title": {
        getter: "$wd->get_title();",
        cmp: "{title}",
        vartype: ""
      },
      "ElementValue": {
        getter: "$wd->find_element({locator}, {locatorBy})->get_value();",
        cmp: "{value}",
        vartype: ""
      },
      "ElementAttribute": {
        getter: "$wd->find_element({locator}, {locatorBy})->get_attribute({attributeName});",
        cmp: "{value}",
        vartype: "String"
      },
      "CookieByName": {
        getter: "get_cookie($wd->get_all_cookies(), {name})",
        cmp: "{value}",
        vartype: ""
      },
      "AlertText": {
        getter: "$wd->get_alert_text()",
        cmp: "{text}",
        vartype: ""
      },
      "Eval": {
        getter: "$wd->execute_script({script})",
        cmp: "{value}",
        vartype: ""
      }
    },
    /**
     * Processes a parameter value into an appropriately escaped expression. Mentions of variables<commit_msg>Some minor cleanup<commit_after>builder.selenium2.io.addLangFormatter({
    name : "Perl - WebDriver",
    extension : ".t",
    not : "! ",
    start : "#!perl\n\nuse strict;\nuse warnings;\nuse Test::More;\nuse Selenium::Remote::Driver;\n\nmy $wd = Selenium::Remote::Driver->new();\n",
    end : "\ndone_testing();\n",
    lineForType : {
        "get" : "ok( $wd->get({url}) );\n",
        "goBack" : "ok( $wd->go_back() );\n",
        "goForward" : "ok( $wd->go_forward() );\n",
        "refresh" : "ok( $wd->refresh() );\n",
        'clickElement' : "ok( $wd->find_element({locator}, {locatorBy})->click() );\n",
        "mouseOverElement":
            "ok( $wd->find_element({locator}, {locatorBy})->hover() );\n",
        "setElementText":
            "my $el = $wd->find_element({locator}, {locatorBy});\n" +
            "ok( $el->click() );\n" +
            "ok( $el->clear() );\n" +
            "ok( $el->send_keys({text}) );\n",
        "sendKeysToElement":
            "my $el = $wd->find_element({locator}, {locatorBy});\n" +
            "ok( $el->click() );\n" +
            "ok( $el->send_keys({text}) );\n",
        "setElementSelected":
            "my $el = $wd->find_element({locator}, {locatorBy});\n" +
            "if(! $el->is_selected()) {\nok( $el->click() );\n}",
        "setElementNotSelected":
            "my $el = $wd->find_element({locator}, {locatorBy});\n" +
            "if($el->is_selected()) {\nok( $el->click() );\n}",
        "submitElement":
          "ok( $wd->find_element({locator}, {locatorBy})->submit() );\n",
    },
    locatorByForType : function (stepType, locatorType, locatorIndex) {
        // Valid identifiers in Perl: class, class_name, css, id, link,
        // link_text, partial_link_text, tag_name, name or xpath.
        // Defaults to 'xpath'.
        return {
            "class"        : '"class"',
            "id"           : '"id"',
            "link text"    : '"link_text"',
            "xpath"        : '"xpath"',
            "css selector" : '"css"',
            "name"         : '"name"'
        }[locatorType];
    },
    assert : function (step, escapeValue, doSubs, getter) {
        if (step.negated) {
            return doSubs(
                "if ({getter} eq {cmp}) {\n" +
                "    die \"!{stepTypeName} failed\";\n" +
                "}\n", getter);
        } else {
            return doSubs(
                "if ({getter} ne {cmp}) {\n" +
                "    die \"!{stepTypeName} failed\";\n" +
                "}\n", getter);
        }
    },
    verify : function (step, escapeValue, doSubs, getter) {
        if (step.negated) {
            return doSubs(
                "if ({getter} eq {cmp}) {\n" +
                "    print \"!{stepTypeName} failed\";\n" +
                "}\n", getter);
        } else {
            return doSubs(
                "if ({getter} ne {cmp}) {\n" +
                "    print \"{stepTypeName} failed\";\n" +
                "}\n", getter);
        }
    },
    waitFor : "",
    store : "${variable} = {getter};\n",
    boolean_assert:
      "if ({posNot}{getter}) {\n" +
      " die (\"{negNot}{stepTypeName} failed\");\n" +
      "}\n",
    boolean_verify:
      "if ({posNot}{getter}) {\n" +
      " print \"{negNot}{stepTypeName} failed\";\n" +
      "}\n",
    boolean_waitFor: "",
    boolean_store:
      "${variable} = {getter};\n",
    // boolean_getters: {
    //   "TextPresent": {
    //     getter: "(strpos($wd->find_element(\"//html\", \"xpath\")->get_text(), {text}) ne false)",
    //     vartype: ""
    //   },
    //   "ElementPresent": {
    //     getter: "(strlen($wd->find_element({locator}, {locatorBy})) != 0)",
    //     vartype: ""
    //   },
    //   "ElementSelected": {
    //     getter: "($wd->find_element({locator}, {locatorBy})->is_selected())",
    //     vartype: ""
    //   },
    //   "CookiePresent": {
    //     getter: "($wd->getAllCookie({name}))",
    //     vartype: ""
    //   },
    //   "AlertPresent": {
    //     getter: "alert_present($wd)",
    //     vartype: ""
    //   }
    // },
    getters: {
      "BodyText": {
        getter: '$wd->find_element("//html", "xpath")->get_text();',
        cmp: "{text}",
        vartype: ""
      },
      "PageSource": {
        getter: "$wd->get_page_source();",
        cmp: "{source}",
        vartype: ""
      },
      "Text": {
        getter: "$wd->find_element({locator}, {locatorBy})->get_text();",
        cmp: "{text}",
        vartype: ""
      },
      "CurrentUrl": {
        getter: "$wd->get_current_url();",
        cmp: "{url}",
        vartype: ""
      },
      "Title": {
        getter: "$wd->get_title();",
        cmp: "{title}",
        vartype: ""
      },
      "ElementValue": {
        getter: "$wd->find_element({locator}, {locatorBy})->get_value();",
        cmp: "{value}",
        vartype: ""
      },
      "ElementAttribute": {
        getter: "$wd->find_element({locator}, {locatorBy})->get_attribute({attributeName});",
        cmp: "{value}",
        vartype: "String"
      },
      "CookieByName": {
        getter: 'get_cookie($wd->get_all_cookies(), {name})',
        cmp: "{value}",
        vartype: ""
      },
      "AlertText": {
        getter: "$wd->get_alert_text()",
        cmp: "{text}",
        vartype: ""
      },
      "Eval": {
        getter: "$wd->execute_script({script})",
        cmp: "{value}",
        vartype: ""
      }
    },
    /**
     * Processes a parameter value into an appropriately escaped expression. Mentions of variables
{'fraction_non_alphanumeric': 0.21869074492099322, 'fraction_numerical': 0.00036117381489841985, 'mean_word_length': 1.7822155237377544, 'pattern_counts': {'":': 42, '<': 3, '<?xml version=': 0, '>': 91, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '453960', 'n_tokens_mistral': 3815, 'n_tokens_neox': 3720, 'n_words': 659}