List of usage examples for org.openqa.selenium PageLoadStrategy NORMAL
PageLoadStrategy NORMAL
To view the source code for org.openqa.selenium PageLoadStrategy NORMAL.
Click Source Link
From source file:com.seleniumtests.uipage.PageObject.java
License:Apache License
private void waitForPageToLoad() { try {/*from www.j av a 2 s. c o m*/ if (robotConfig().getPageLoadStrategy() == PageLoadStrategy.NORMAL) { new WebDriverWait(driver, 5).until(ExpectedConditions .jsReturnsValue("if (document.readyState === \"complete\") { return \"ok\"; }")); } else if (robotConfig().getPageLoadStrategy() == PageLoadStrategy.EAGER) { new WebDriverWait(driver, 5).until(ExpectedConditions .jsReturnsValue("if (document.readyState === \"interactive\") { return \"ok\"; }")); } } catch (TimeoutException e) { // nothing } // populate page info try { capturePageSnapshot(); } catch (Exception ex) { logger.error(ex); throw ex; } }
From source file:com.seleniumtests.ut.browserfactory.TestChromeCapabilityFactory.java
License:Apache License
@BeforeMethod(groups = { "ut" })
public void init() {
browserInfos = new HashMap<>();
browserInfos.put(BrowserType.CHROME, Arrays.asList(new BrowserInfo(BrowserType.CHROME, "72.0", "", false)));
PowerMockito.mockStatic(OSUtility.class, Mockito.CALLS_REAL_METHODS);
PowerMockito.when(OSUtility.getInstalledBrowsersWithVersion()).thenReturn(browserInfos);
Mockito.when(config.getTestContext()).thenReturn(context);
Mockito.when(config.getDebug()).thenReturn(Arrays.asList(DebugMode.NONE));
Mockito.when(config.getPageLoadStrategy()).thenReturn(PageLoadStrategy.NORMAL);
}
From source file:com.seleniumtests.ut.browserfactory.TestEdgeCapabilityFactory.java
License:Apache License
@BeforeMethod(groups = { "ut" })
public void init() {
PowerMockito.mockStatic(System.class);
PowerMockito.when(System.getProperty(anyString())).thenCallRealMethod();
PowerMockito.when(System.setProperty(anyString(), anyString())).thenCallRealMethod();
PowerMockito.when(System.clearProperty(anyString())).thenCallRealMethod();
PowerMockito.when(System.getProperty("os.name")).thenReturn("Windows 10");
Map<BrowserType, List<BrowserInfo>> browserInfos = new HashMap<>();
browserInfos.put(BrowserType.EDGE, Arrays.asList(new BrowserInfo(BrowserType.EDGE, "14393", "", false)));
PowerMockito.mockStatic(OSUtility.class);
PowerMockito.when(OSUtility.getInstalledBrowsersWithVersion()).thenReturn(browserInfos);
PowerMockito.when(OSUtility.getCurrentPlatorm()).thenReturn(Platform.WINDOWS);
PowerMockito.mockStatic(OSUtilityFactory.class);
PowerMockito.when(OSUtilityFactory.getInstance()).thenReturn(osUtility);
Mockito.when(config.getDebug()).thenReturn(Arrays.asList(DebugMode.NONE));
Mockito.when(config.getPageLoadStrategy()).thenReturn(PageLoadStrategy.NORMAL);
when(osUtility.getProgramExtension()).thenReturn(".exe");
}
From source file:com.seleniumtests.ut.browserfactory.TestFirefoxCapabilitiesFactory.java
License:Apache License
@BeforeMethod(groups = { "ut" })
public void init() {
browserInfos = new HashMap<>();
browserInfos.put(BrowserType.FIREFOX,
Arrays.asList(new BrowserInfo(BrowserType.FIREFOX, "47.0", "/usr/bin/firefox", false)));
PowerMockito.mockStatic(OSUtility.class, Mockito.CALLS_REAL_METHODS);
PowerMockito.when(OSUtility.getInstalledBrowsersWithVersion()).thenReturn(browserInfos);
Mockito.when(config.getTestContext()).thenReturn(context);
Mockito.when(config.getDebug()).thenReturn(Arrays.asList(DebugMode.NONE));
Mockito.when(config.getPageLoadStrategy()).thenReturn(PageLoadStrategy.NORMAL);
}
From source file:com.seleniumtests.ut.browserfactory.TestMarionetteCapabilitiesFactory.java
License:Apache License
@BeforeMethod(groups = { "ut" })
public void init() {
Map<BrowserType, List<BrowserInfo>> browserInfos = new HashMap<>();
browserInfos.put(BrowserType.FIREFOX,
Arrays.asList(new BrowserInfo(BrowserType.FIREFOX, "58.0", "/usr/bin/firefox", false)));
PowerMockito.mockStatic(OSUtility.class, Mockito.CALLS_REAL_METHODS);
PowerMockito.when(OSUtility.getInstalledBrowsersWithVersion()).thenReturn(browserInfos);
Mockito.when(config.getTestContext()).thenReturn(context);
Mockito.when(config.getDebug()).thenReturn(Arrays.asList(DebugMode.NONE));
Mockito.when(config.getPageLoadStrategy()).thenReturn(PageLoadStrategy.NORMAL);
}
From source file:com.seleniumtests.ut.core.TestSeleniumTestContext.java
License:Apache License
@Test(groups = "ut context") public void testPageLoadStrategyNull(final ITestContext testNGCtx, final XmlTest xmlTest) { initThreadContext(testNGCtx);/*from www. ja v a 2 s. co m*/ SeleniumTestsContextManager.getThreadContext().setPageLoadStrategy(null); Assert.assertEquals(SeleniumTestsContextManager.getThreadContext().getPageLoadStrategy(), PageLoadStrategy.NORMAL); }