Search in sources :

Example 11 with NgWebDriver

use of com.github.sergueik.jprotractor.NgWebDriver in project selenium_java by sergueik.

the class NgScrollableTableTest method setUp.

@Before
public void setUp() throws Exception {
    // change according to platform
    System.setProperty("webdriver.chrome.driver", osName.toLowerCase().startsWith("windows") ? new File("c:/java/selenium/chromedriver.exe").getAbsolutePath() : resolveEnvVars(chromeDriverPath));
    DesiredCapabilities capabilities = DesiredCapabilities.chrome();
    if (isMobile) {
        Map<String, String> mobileEmulation = new HashMap<>();
        mobileEmulation.put("deviceName", "Google Nexus 5");
        Map<String, Object> chromeOptions = new HashMap<>();
        chromeOptions.put("mobileEmulation", mobileEmulation);
        capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
        seleniumDriver = new ChromeDriver(capabilities);
        // set ignoreSynchronization to true to handle page sync ourselves
        // instead of using waitForAngular call in JProtractor
        ngDriver = new NgWebDriver(seleniumDriver, true);
    } else {
        seleniumDriver = new ChromeDriver(capabilities);
        ngDriver = new NgWebDriver(seleniumDriver, true);
    }
    ngDriver.get(baseUrl);
    ngDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    page = new NgScrollableTablePage();
    page.setDriver(ngDriver);
    JPageFactory.initElements(ngDriver, channel, page);
}
Also used : NgWebDriver(com.github.sergueik.jprotractor.NgWebDriver) HashMap(java.util.HashMap) NgScrollableTablePage(org.henrrich.jpagefactory.example.scrollabletable.NgScrollableTablePage) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) ChromeDriver(org.openqa.selenium.chrome.ChromeDriver) File(java.io.File) Before(org.junit.Before)

Example 12 with NgWebDriver

use of com.github.sergueik.jprotractor.NgWebDriver in project selenium_java by sergueik.

the class NgMultiSelectTest method setUp.

@Before
public void setUp() throws Exception {
    // change according to platform
    // NOTE:
    // java.lang.IllegalStateException: The driver executable does not exist: /var/run/chromedriver
    // java.lang.IllegalStateException: The driver is not executable: /var/run/chromedriver
    System.setProperty("webdriver.chrome.driver", osName.toLowerCase().startsWith("windows") ? new File("c:/java/selenium/chromedriver.exe").getAbsolutePath() : resolveEnvVars(chromeDriverPath));
    DesiredCapabilities capabilities = DesiredCapabilities.chrome();
    if (isMobile) {
        Map<String, String> mobileEmulation = new HashMap<>();
        mobileEmulation.put("deviceName", "Google Nexus 5");
        Map<String, Object> chromeOptions = new HashMap<>();
        chromeOptions.put("mobileEmulation", mobileEmulation);
        capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
        seleniumDriver = new ChromeDriver(capabilities);
        // set ignoreSynchronization to true to handle page sync ourselves
        // instead of using waitForAngular call in JProtractor
        ngDriver = new NgWebDriver(seleniumDriver, true);
    } else {
        seleniumDriver = new ChromeDriver(capabilities);
        ngDriver = new NgWebDriver(seleniumDriver);
    }
    ngDriver.get(baseUrl);
    ngDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    page = new NgMultiSelectPage();
    page.setDriver(ngDriver);
    JPageFactory.initElements(ngDriver, channel, page);
}
Also used : NgWebDriver(com.github.sergueik.jprotractor.NgWebDriver) HashMap(java.util.HashMap) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) ChromeDriver(org.openqa.selenium.chrome.ChromeDriver) File(java.io.File) Before(org.junit.Before)

Example 13 with NgWebDriver

use of com.github.sergueik.jprotractor.NgWebDriver in project selenium_java by sergueik.

the class NgQualityShepherdTest method setUp.

@Before
public void setUp() throws Exception {
    // change according to platformm
    System.setProperty("webdriver.chrome.driver", osName.toLowerCase().startsWith("windows") ? new File("c:/java/selenium/chromedriver.exe").getAbsolutePath() : resolveEnvVars(chromeDriverPath));
    DesiredCapabilities capabilities = DesiredCapabilities.chrome();
    if (isMobile) {
        Map<String, String> mobileEmulation = new HashMap<>();
        mobileEmulation.put("deviceName", "Google Nexus 5");
        Map<String, Object> chromeOptions = new HashMap<>();
        chromeOptions.put("mobileEmulation", mobileEmulation);
        capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
        seleniumDriver = new ChromeDriver(capabilities);
        // set ignoreSynchronization to true to handle page sync ourselves
        // instead of using waitForAngular call in JProtractor
        ngDriver = new NgWebDriver(seleniumDriver, true);
    } else {
        seleniumDriver = new ChromeDriver(capabilities);
        ngDriver = new NgWebDriver(seleniumDriver);
    }
    ngDriver.get(baseUrl);
    ngDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    page = new NgQualityShepherdPage();
    page.setDriver(ngDriver);
    JPageFactory.initElements(ngDriver, channel, page);
}
Also used : NgWebDriver(com.github.sergueik.jprotractor.NgWebDriver) HashMap(java.util.HashMap) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ChromeDriver(org.openqa.selenium.chrome.ChromeDriver) File(java.io.File) Before(org.junit.Before)

Example 14 with NgWebDriver

use of com.github.sergueik.jprotractor.NgWebDriver in project selenium_java by sergueik.

the class SuperCalculatorTest method setUp.

@Before
public void setUp() throws Exception {
    // change according to platformm
    System.setProperty("webdriver.chrome.driver", osName.toLowerCase().startsWith("windows") ? new File("c:/java/selenium/chromedriver.exe").getAbsolutePath() : resolveEnvVars(chromeDriverPath));
    DesiredCapabilities capabilities = DesiredCapabilities.chrome();
    if (isMobile) {
        Map<String, String> mobileEmulation = new HashMap<>();
        mobileEmulation.put("deviceName", "Google Nexus 5");
        Map<String, Object> chromeOptions = new HashMap<>();
        chromeOptions.put("mobileEmulation", mobileEmulation);
        capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
        seleniumDriver = new ChromeDriver(capabilities);
        // set ignoreSynchronization to true to handle page sync ourselves
        // instead of using waitForAngular call in JProtractor
        ngDriver = new NgWebDriver(seleniumDriver, true);
    } else {
        /*
			 * DesiredCapabilities capabilities = new
			 * DesiredCapabilities("firefox", "", Platform.ANY); FirefoxProfile
			 * profile = new ProfilesIni().getProfile("default");
			 * profile.setEnableNativeEvents(false);
			 * capabilities.setCapability("firefox_profile", profile);
			 * seleniumDriver = new FirefoxDriver(capabilities);
			 */
        seleniumDriver = new ChromeDriver(capabilities);
        ngDriver = new NgWebDriver(seleniumDriver);
    }
    ngDriver.get(baseUrl);
    ngDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    superCalculatorPage = new SuperCalculatorPage();
    JPageFactory.initElements(ngDriver, channel, superCalculatorPage);
}
Also used : NgWebDriver(com.github.sergueik.jprotractor.NgWebDriver) HashMap(java.util.HashMap) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) ChromeDriver(org.openqa.selenium.chrome.ChromeDriver) File(java.io.File) Before(org.junit.Before)

Example 15 with NgWebDriver

use of com.github.sergueik.jprotractor.NgWebDriver in project selenium_java by sergueik.

the class TodoListTest method setUp.

@Before
public void setUp() throws Exception {
    // change according to platformm
    System.setProperty("webdriver.chrome.driver", osName.toLowerCase().startsWith("windows") ? new File("c:/java/selenium/chromedriver.exe").getAbsolutePath() : resolveEnvVars(chromeDriverPath));
    DesiredCapabilities capabilities = DesiredCapabilities.chrome();
    if (isMobile) {
        Map<String, String> mobileEmulation = new HashMap<>();
        mobileEmulation.put("deviceName", "Google Nexus 5");
        Map<String, Object> chromeOptions = new HashMap<>();
        chromeOptions.put("mobileEmulation", mobileEmulation);
        capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
        seleniumDriver = new ChromeDriver(capabilities);
        // set ignoreSynchronization to true to handle page sync ourselves
        // instead of using waitForAngular call in JProtractor
        ngDriver = new NgWebDriver(seleniumDriver, true);
    } else {
        /*
			 * DesiredCapabilities capabilities = new
			 * DesiredCapabilities("firefox", "", Platform.ANY); FirefoxProfile
			 * profile = new ProfilesIni().getProfile("default");
			 * profile.setEnableNativeEvents(false);
			 * capabilities.setCapability("firefox_profile", profile);
			 * seleniumDriver = new FirefoxDriver(capabilities);
			 */
        seleniumDriver = new ChromeDriver(capabilities);
        ngDriver = new NgWebDriver(seleniumDriver);
    }
    ngDriver.get(baseUrl);
    ngDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    page = new TodoListPage();
    page.setDriver(ngDriver);
    JPageFactory.initElements(ngDriver, channel, page);
}
Also used : NgWebDriver(com.github.sergueik.jprotractor.NgWebDriver) HashMap(java.util.HashMap) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) ChromeDriver(org.openqa.selenium.chrome.ChromeDriver) File(java.io.File) TodoListPage(org.henrrich.jpagefactory.example.todolist.TodoListPage) Before(org.junit.Before)

Aggregations

NgWebDriver (com.github.sergueik.jprotractor.NgWebDriver)25 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)18 BeforeClass (org.junit.BeforeClass)16 Actions (org.openqa.selenium.interactions.Actions)16 Dimension (org.openqa.selenium.Dimension)15 File (java.io.File)6 Before (org.junit.Before)6 ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)6 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)6 HashMap (java.util.HashMap)5 NgWebElement (com.github.sergueik.jprotractor.NgWebElement)2 Formatter (java.util.Formatter)2 Test (org.junit.Test)2 Boolean.parseBoolean (java.lang.Boolean.parseBoolean)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 NgScrollableTablePage (org.henrrich.jpagefactory.example.scrollabletable.NgScrollableTablePage)1 TodoListPage (org.henrrich.jpagefactory.example.todolist.TodoListPage)1 NoSuchElementException (org.openqa.selenium.NoSuchElementException)1 TimeoutException (org.openqa.selenium.TimeoutException)1 WebDriver (org.openqa.selenium.WebDriver)1