Search in sources :

Example 1 with NgScrollableTablePage

use of org.henrrich.jpagefactory.example.scrollabletable.NgScrollableTablePage 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)

Aggregations

NgWebDriver (com.github.sergueik.jprotractor.NgWebDriver)1 File (java.io.File)1 HashMap (java.util.HashMap)1 NgScrollableTablePage (org.henrrich.jpagefactory.example.scrollabletable.NgScrollableTablePage)1 Before (org.junit.Before)1 ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)1 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)1