package com.sdl.selenium.extjs6.button;

import com.sdl.selenium.bootstrap.button.Download;
import com.sdl.selenium.web.SearchType;
import com.sdl.selenium.web.WebLocator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DownloadButton extends Button implements Download {
    private static final Logger LOGGER = LoggerFactory.getLogger(DownloadButton.class);

    public DownloadButton() {
        withClassName("DownloadButton");
    }

    public DownloadButton(WebLocator container) {
        this();
        withContainer(container);
    }

    public DownloadButton(WebLocator container, String text) {
        this(container);
        withText(text, SearchType.EQUALS);
    }

    /**
     * if WebDriverConfig.isSilentDownload() is true, se face silentDownload, is is false se face download with AutoIT.
     * Download file with AutoIT, works only on FireFox. SilentDownload works FireFox and Chrome
     * Use only this: button.download("C:\\TestSet.tmx");
     * return true if the downloaded file is the same one that is meant to be downloaded, otherwise returns false.
     *
     * @param fileName e.g. "TestSet.tmx"
     */
    @Override
    public boolean download(String fileName) {
        openBrowse();
        return executor.download(fileName, 10000L);
    }

    private void openBrowse() {
        executor.browse(this);
    }
}

@@ -259,16 +259,21 @@
 extends 
+Split
 Button i
@@ -1298,24 +1298,500 @@
 0L);%0A    %7D%0A%0A
+    /**%0A     * if WebDriverConfig.isSilentDownload() is true, se face silentDownload, is is false se face download with AutoIT.%0A     * @param name e.g. TBX%0A     * @param fileName e.g. %22TestSet.tmx%22%0A     * @return true if the downloaded file is the same one that is meant to be downloaded, otherwise returns false.%0A     */%0A    public boolean downloadFromMenu(String name, String fileName) %7B%0A        clickOnMenu(name);%0A        return executor.download(fileName, 10000L);%0A    %7D%0A%0A
     private 

add downloadFromMenu(String name, String fileName) method on DownloadButton in extjs6