Class WebFormScript


  • public final class WebFormScript
    extends Object
    Calls the test helper functions that the E2E container plugin injects into every formcycle form as window.xmTest (see form-script.js). The current page of the driver must be a formcycle form.
    Since:
    8.5.7
    • Method Detail

      • setRepetitions

        public static void setRepetitions​(com.codeborne.selenide.SelenideDriver driver,
                                          String name,
                                          int count)
        Sets the number of repetitions of a repeated form element or container.
        Parameters:
        driver - The Selenide driver that controls the browser.
        name - Name of the repeated form element or container.
        count - The number of repetitions to set.
      • setUploadToContent

        public static void setUploadToContent​(com.codeborne.selenide.SelenideDriver driver,
                                              String name,
                                              int index,
                                              String content,
                                              String fileName,
                                              String contentType)
        Sets an upload element to a file with the given text content.
        Parameters:
        driver - The Selenide driver that controls the browser.
        name - Name of the upload element.
        index - Index of the repetition, for repeated upload elements; 0 otherwise.
        content - Text content of the file.
        fileName - File name to use.
        contentType - Content type to use for the file.
      • setUploadToGeneratedImage

        public static void setUploadToGeneratedImage​(com.codeborne.selenide.SelenideDriver driver,
                                                     String name,
                                                     int index,
                                                     String seed,
                                                     String fileName,
                                                     String contentType)
        Sets an upload element to an image generated by the browser from the given seed. The same seed always results in the same image (300x150 pixels), but the encoded file may differ between browsers.
        Parameters:
        driver - The Selenide driver that controls the browser.
        name - Name of the upload element.
        index - Index of the repetition, for repeated upload elements; 0 otherwise.
        seed - Seed for generating the image.
        fileName - File name to use.
        contentType - Content type of the image, which determines its format, such as image/png.