-
Notifications
You must be signed in to change notification settings - Fork 143
Magic Samples
Golovin Gleb edited this page Mar 19, 2015
·
4 revisions
This article is a stub. Please help us improve it.
- Run
Winium.Desktop.Driver.exe --verbose
-
Write your
calculator.py
# coding: utf-8 from selenium import webdriver driver = webdriver.Remote( command_executor='http://localhost:9999', desired_capabilities={ "debugConnectToRunningApp": 'false', "app": r"C:/windows/system32/calc.exe" }) window = driver.find_element_by_class_name('CalcFrame') view_menu_item = window.find_element_by_id('MenuBar').find_element_by_name('View') view_menu_item.click() view_menu_item.find_element_by_name('Scientific').click() view_menu_item.click() view_menu_item.find_element_by_name('History').click() window.find_element_by_id('132').click() window.find_element_by_id('93').click() window.find_element_by_id('134').click() window.find_element_by_id('97').click() window.find_element_by_id('138').click() window.find_element_by_id('121').click() driver.close()
-
Run
python calculator.py
namespace ConsoleApplication
{
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
public class Program
{
private static void Main(string[] args)
{
var dc = new DesiredCapabilities();
dc.SetCapability("app", @"C:/windows/system32/calc.exe");
var driver = new RemoteWebDriver(new Uri("http://localhost:9999"), dc);
var window = driver.FindElementByClassName("CalcFrame");
var viewMenuItem = window.FindElement(By.Id("MenuBar")).FindElement(By.Name("View"));
viewMenuItem.FindElement(By.Name("Scientific")).Click();
viewMenuItem.FindElement(By.Name("History")).Click();
window.FindElement(By.Id("132")).Click(); // 2
window.FindElement(By.Id("93")).Click(); // +
window.FindElement(By.Id("134")).Click(); // 4
window.FindElement(By.Id("97")).Click(); // ^
window.FindElement(By.Id("138")).Click(); // 8
window.FindElement(By.Id("121")).Click(); // =
driver.Close();
}
}
}
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();
} }