-

   rss_rss_hh_new

 - e-mail

 

 -

 LiveInternet.ru:
: 17.03.2011
:
:
: 51

:


[ ] Windows- Winium

, 20 2017 . 15:27 +


Winium Windows-. , Winium , Windows- ( , tab-). (, , , , , : C:\Program Files (x86)\Windows Kits\8.1\bin\x64). inspect uiverify, , , .

, , , , ClassName, Name AutomationId. , , . , , GUI .

Winium Selenium Python Java; , , Java.


-, Winium Desktop Driver. , , . . Selenium Windows-.

-, , Java-IDE ( IntelliJ IDEA Community, ) JDK. / JAVA_HOME JDK ( C:\Program Files\Java\jdk1.8.0_131).

-, Selenium , Selenium Standalone Server (JAR-).

Java- External libraries ( Project Structure ( Ctrl+Alt+Shift+S), Project Settings Libraries ) JAR-. , .


, , Winium.Desktop.Driver . , , . , ProcessBuilder:

ProcessBuilder pro = new ProcessBuilder(windriverPath + windriverName, windriverParam);
shell = pro.start();
//< >
shell.destroy();

windriverPath, windriverName ; windriverParam , .

Winium :

DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("app",""); //    - 
cap.setCapability("launchDelay","5"); //   
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:9999"),cap); //      Winium 

- , - , 2 3 .

, - , . By.name Name, By.className ClassName By.xpath . / , findElement, , findElements. tab-. :


WebElement wrk = driver.findElement(By.name("  Name")); // ,    Name
List wrkL = driver.findElements(By.className("  ClassName")); //     ClassName

:


WebElement wrk1 = wrk.findElement(By.name("  Name"));

, .. Name ClassName, , By.xpath.

xpath ( , ). xpath IsOffscreen, AutomationId, HasKeyboardFocus:


WebElement field = wrk.findElement(By.xpath("*[@HasKeyboardFocus='True']")); //   wrk,    

xpath, , , xpath:


String xpathStr = "*[(@AutomationId='" + autId + "') and (@IsOffscreen='False')]"; //       -  AutomationId = autId     IsOffscreen = False 
log("Performing xpath search: " + xpathStr);
WebElement tWrk = wrk1.findElement(By.xpath(xpathStr));

, xpath' , .

, , , . , .

. sendKeys( ) . , , (, "+" Shift, , "+", "+="). , "+" "+=", . , , . , , , .

. , Actions:


Actions builder = new Actions(driver);
Action enter = builder
        .moveToElement(wrk)
        .moveByOffset(x,y)
        .click()
        .build();
enter.perform();

wrk WebElement, ; x, y , ( x , y ).

-


, . name, className automationId .

- , .

, .


Winium . , . , - Winium. , . !
Original source: habrahabr.ru (comments, light).

https://habrahabr.ru/post/331292/

:  

: [1] []
 

:
: 

: ( )

:

  URL