package litecartTest.gridBrowsers;

import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.net.MalformedURLException;
import java.net.URL;

/**
 * Created by Marina on 19.03.2017.
 */
public class GridVirtualWindowsTest {


    private RemoteWebDriver driverVirtual;
    private WebDriverWait waitVirtual;

    @BeforeClass
    public void setupBrowsersDriver() throws MalformedURLException {
        DesiredCapabilities desiredCapabilitiesVirtual;
        desiredCapabilitiesVirtual = DesiredCapabilities.internetExplorer();
        desiredCapabilitiesVirtual.setCapability("platform", "VISTA");
        driverVirtual = new RemoteWebDriver(new URL("http://192.168.1.39:4444/wd/hub"), desiredCapabilitiesVirtual);
        waitVirtual = new WebDriverWait(driverVirtual, 10);
    }

    @Test
    public void testGridIeOnVirtual() {
        driverVirtual.get("http://localhost/litecart/admin/");
        driverVirtual.findElement(By.name("username")).sendKeys("admin");
        driverVirtual.findElement(By.name("password")).sendKeys("admin");
        driverVirtual.findElement(By.name("login")).click();
    }

    @AfterClass
    public void stop() {
        driverVirtual.quit();
        driverVirtual = null;
    }
}

@@ -60,16 +60,120 @@
 ium.By;%0A
+import org.openqa.selenium.ie.InternetExplorerDriver;%0Aimport org.openqa.selenium.remote.CapabilityType;%0A
 import o
@@ -262,32 +262,90 @@
 emoteWebDriver;%0A
+import org.openqa.selenium.support.ui.ExpectedConditions;%0A
 import org.openq
@@ -562,16 +562,54 @@
 net.URL;
+%0Aimport java.util.concurrent.TimeUnit;
 %0A%0A/**%0A *
@@ -781,24 +781,42 @@
 @BeforeClass
+(alwaysRun = true)
 %0A    public 
@@ -1002,24 +1002,757 @@
 Explorer();%0A
+%0A       /* desiredCapabilitiesVirtual.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);%0A      //  desiredCapabilitiesVirtual.setCapability(InternetExplorerDriver.INITIAL_BROWSER_URL, %22http://www.google.com%22);%0A        desiredCapabilitiesVirtual.setCapability(%22ignoreProtectedModeSettings%22, true);%0A        desiredCapabilitiesVirtual.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);%0A        desiredCapabilitiesVirtual.setJavascriptEnabled(true);%0A        desiredCapabilitiesVirtual.setCapability(%22requireWindowFocus%22, true);%0A        desiredCapabilitiesVirtual.setCapability(%22enablePersistentHover%22, false);%0A        desiredCapabilitiesVirtual.setCapability(%22requireWindowFocus%22, true);*/%0A%0A
         desi
@@ -1809,16 +1809,25 @@
 VISTA%22);
+  //VISTA
 %0A       
@@ -1936,16 +1936,183 @@
 rtual);%0A
+//        driverVirtual.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);%0A//        driverVirtual.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);%0A//
         
@@ -2217,16 +2217,44 @@
 irtual()
+ throws InterruptedException
  %7B%0A     
@@ -2286,17 +2286,20 @@
 p://
-localhost
+192.168.1.39
 /lit
@@ -2310,24 +2310,111 @@
 t/admin/%22);%0A
+   //     Thread.sleep(5000L);%0A   //     waitElementPresence(By.name(%22username%22), 30);%0A
         driv
@@ -2618,26 +2618,73 @@
     
-%7D%0A%0A    @AfterClass
+    Thread.sleep(3000L);%0A    %7D%0A%0A    @AfterClass(alwaysRun = true)
 %0A   
@@ -2770,11 +2770,245 @@
 l;%0A    %7D
+%0A%0A    public void waitElementPresence(By element, int timeOutInSeconds) %7B%0A        WebDriverWait wait = new WebDriverWait(driverVirtual, timeOutInSeconds);%0A        wait.until(ExpectedConditions.presenceOfElementLocated(element));%0A    %7D
 %0A%7D%0A

Сделан простой грид