2gis / Winium.Desktop

Winium.Desktop is Selenium Remote WebDriver implementation for automated testing of Windows application based on WinFroms and WPF platforms.
Mozilla Public License 2.0
404 stars 141 forks source link

How can I run Winium test automation from local machine on to remote machine? #219

Open aliwarsame opened 6 years ago

aliwarsame commented 6 years ago

Hi All,

I want to trigger Winium tests from local machine which then runs the tests on a remote machine (I couldn't find any post about this).

I can happily trigger Winium tests from local machine which then runs the tests on a Virtual Box that is running on my local machine.

Thanks in advance.

voloxastik commented 6 years ago

You need to start the driver on the remote machine and specify the IP of the remote machine

driver = webdriver.Remote( command_executor='http://IP:9999', desired_capabilities={ "debugConnectToRunningApp": 'false', "app": r"C:/windows/system32/calc.exe" })

LeoDOD commented 6 years ago

sorry i'm having a similar issue, could you please elaborate a bit more?

voloxastik commented 6 years ago

sorry i'm having a similar issue, could you please elaborate a bit more?

What more can I tell you?

sandraj-cuelogic commented 6 years ago

@voloxastik - Is there a way to execute winium tests using selenium grid. I have found references to capabilities of winium driver (windows phone) & selenium grid but not for desktop application.

Any help is highly appreciated. Thanks.

voloxastik commented 6 years ago

@sandraj-cuelogic I do not work with this. Perhaps this will help you Support selenium grid #97

priyankalad2012 commented 2 months ago

Hello i am facing servar error .

Exception in thread "main" org.openqa.selenium.NoSuchElementException: Element cannot be found (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 36.55 seconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: '2.48.2', revision: '41bccdd10cf2c0560f637404c2d96164b67d9d67', time: '2015-10-09 13:08:06' System info: host: 'DESKTOP-UMGPT06', ip: '192.168.29.69', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '22.0.2' Driver info: org.openqa.selenium.winium.WiniumDriver Capabilities [{app=C:\Users\Admin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\ApTask.lnk, args=, innerPort=9998, debugConnectToRunningApp=false, keyboardSimulator=1, launchDelay=0, platform=ANY}] Session ID: AwesomeSession *** Element info: {Using=id, value=email} at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647) at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:353) at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:403) at sampleDesktopApplication.TestApTaskDialer.main(TestApTaskDialer.java:37)

For this Code: -

package sampleDesktopApplication;

import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.winium.DesktopOptions; import org.openqa.selenium.winium.WiniumDriver;

public class TestApTaskDialer {

@SuppressWarnings("deprecation")
public static void main(String[] args) throws MalformedURLException, InterruptedException {
    // TODO Auto-generated method stub

    DesktopOptions option = new DesktopOptions();

    option.setApplicationPath("C:\\Users\\Admin\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\XYZ.lnk");

    WiniumDriver driver = null;
    try {
        driver = new WiniumDriver(new URL("http://localhost:9999"),option);
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

driver.findElementById("email").sendKeys("brijeshb@XYZ.com");
driver.findElementById("password").sendKeys("Admin@123");

driver.findElementByName("Sign In").click();

Thread.sleep(5000);
driver.quit();

}

}

What is the root cause of the error- I cant understand. please give any solution