Skip to content

Winium Desktop C# example for reached any folder path and unzip files from folder

sheikhsamina edited this page Aug 28, 2018 · 1 revision

using System.Threading; using WindowsInput; using WindowsInput.Native;

namespace windows10automation {

public class Calculator
{
    static InputSimulator s;


    static void Main(string[] args)
    {
        
        var winFinder4 = Winium.Cruciatus.Core.By.Name("Running applications");
        var win4 = Winium.Cruciatus.CruciatusFactory.Root.FindElement(winFinder4);
        var winFinder2 = Winium.Cruciatus.Core.By.Name("Windows Explorer");
        var win2 = Winium.Cruciatus.CruciatusFactory.Root.FindElement(winFinder2);
      
        win2.Click();

       var winFinder5 = Winium.Cruciatus.Core.By.Name("Libraries");
        var win5 = Winium.Cruciatus.CruciatusFactory.Root.FindElement(winFinder5);
       


        var winFinder3 = Winium.Cruciatus.Core.By.Uid("1001");
        var win3 = Winium.Cruciatus.CruciatusFactory.Root.FindElement(winFinder3);
   
        win3.SetText("D:\\DIS\\CCD_AutoExtraction\\Prime\\Franklin");
       var winFinder7 = Winium.Cruciatus.Core.By.Uid("Item 100");
        var win7 = Winium.Cruciatus.CruciatusFactory.Root.FindElement(winFinder7);
        win7.Click();
       s = new InputSimulator();
        s.Keyboard.KeyDown(VirtualKeyCode.CONTROL);
        s.Keyboard.KeyPress(VirtualKeyCode.VK_A);
        s.Keyboard.KeyUp(VirtualKeyCode.CONTROL);
        s.Keyboard.KeyDown(VirtualKeyCode.SHIFT);

        s.Keyboard.KeyPress(VirtualKeyCode.F10);
        s.Keyboard.KeyUp(VirtualKeyCode.SHIFT);
        var winFinder8 = Winium.Cruciatus.Core.By.Name("Menu");
        var win8 = Winium.Cruciatus.CruciatusFactory.Root.FindElement(winFinder8);
        var winFinder9 = Winium.Cruciatus.Core.By.Name("Extract Here");
        var win9 = Winium.Cruciatus.CruciatusFactory.Root.FindElement(winFinder9);
        win9.Click();
        var winFinder10 = Winium.Cruciatus.Core.By.Name("Enter password");
        var win10 = Winium.Cruciatus.CruciatusFactory.Root.FindElement(winFinder10);
        var winFinder11 = Winium.Cruciatus.Core.By.Uid("101");
        var win11 = Winium.Cruciatus.CruciatusFactory.Root.FindElement(winFinder11);
        var winFinder12 = Winium.Cruciatus.Core.By.Uid("1001");
        var win12 = Winium.Cruciatus.CruciatusFactory.Root.FindElement(winFinder12);
        win12.SetText("garage123$");
        var winFinder14 = Winium.Cruciatus.Core.By.Name("Use for all archives");
        var win14 = Winium.Cruciatus.CruciatusFactory.Root.FindElement(winFinder14);
        win14.Click();
       

            var winFinder13 = Winium.Cruciatus.Core.By.Name("OK");
            var win13 = Winium.Cruciatus.CruciatusFactory.Root.FindElement(winFinder13);
            win13.Click();

        var winFinder15 = Winium.Cruciatus.Core.By.Name("Confirm file replace");
            var win15 = Winium.Cruciatus.CruciatusFactory.Root.FindElement(winFinder15);
         
            var winFinder16 = Winium.Cruciatus.Core.By.Name("Yes to All");
            var win16 = Winium.Cruciatus.CruciatusFactory.Root.FindElement(winFinder16);
            win16.Click();

package testcases; import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.By; import org.openqa.selenium.winium.DesktopOptions; import org.openqa.selenium.winium.WiniumDriver public class calculator {

public static void main(String[] args) throws MalformedURLException, InterruptedException {
    DesktopOptions option = new DesktopOptions();
    option.setApplicationPath("C:\\Windows\\System32\\calc.exe");
    WiniumDriver driver = new WiniumDriver(new URL("http://localhost:9999"), option);
    Thread.sleep(5);
    driver.findElement(By.name("Five")).click();
    driver.findElement(By.id("multiplyButton")).click();
    driver.findElement(By.name("Six")).click();
    driver.findElement(By.id("equalButton")).click();

} }

Clone this wiki locally