Search in sources :

Example 96 with RemoteWebDriver

use of org.openqa.selenium.remote.RemoteWebDriver in project flue2ent by DefinityLabs.

the class ScrollPluginTest method up_executesJavascript.

@Test
public void up_executesJavascript() {
    RemoteWebDriver mockedDriver = mock(RemoteWebDriver.class);
    ScrollPlugin scrollPlugin = new ScrollPlugin(mockedDriver);
    ScrollPlugin result = scrollPlugin.up();
    verify(mockedDriver).executeScript("window.scrollBy(0, -250);");
    assertThat(result).isSameAs(scrollPlugin);
}
Also used : RemoteWebDriver(org.openqa.selenium.remote.RemoteWebDriver) Test(org.junit.Test)

Example 97 with RemoteWebDriver

use of org.openqa.selenium.remote.RemoteWebDriver in project flue2ent by DefinityLabs.

the class ScrollPluginTest method to_element_executesJavascript.

@Test
public void to_element_executesJavascript() {
    RemoteWebDriver mockedDriver = mock(RemoteWebDriver.class);
    ScrollPlugin scrollPlugin = new ScrollPlugin(mockedDriver);
    WebElement webElement = mock(WebElement.class);
    WebElementWrapper element = new WebElementWrapper(webElement);
    ScrollPlugin result = scrollPlugin.to(element);
    verify(mockedDriver).executeScript("arguments[0].scrollIntoView(true);", webElement);
    assertThat(result).isSameAs(scrollPlugin);
}
Also used : RemoteWebDriver(org.openqa.selenium.remote.RemoteWebDriver) WebElement(org.openqa.selenium.WebElement) WebElementWrapper(org.definitylabs.flue2ent.element.WebElementWrapper) Test(org.junit.Test)

Example 98 with RemoteWebDriver

use of org.openqa.selenium.remote.RemoteWebDriver in project flue2ent by DefinityLabs.

the class ScrollPluginTest method to_executesJavascript.

@Test
public void to_executesJavascript() {
    RemoteWebDriver mockedDriver = mock(RemoteWebDriver.class);
    ScrollPlugin scrollPlugin = new ScrollPlugin(mockedDriver);
    ScrollPlugin result = scrollPlugin.to(100, 200);
    verify(mockedDriver).executeScript("window.scrollTo(100, 200);");
    assertThat(result).isSameAs(scrollPlugin);
}
Also used : RemoteWebDriver(org.openqa.selenium.remote.RemoteWebDriver) Test(org.junit.Test)

Example 99 with RemoteWebDriver

use of org.openqa.selenium.remote.RemoteWebDriver in project flue2ent by DefinityLabs.

the class PagePluginTest method getTitle_returnsWebDriverTitle.

@Test
public void getTitle_returnsWebDriverTitle() {
    RemoteWebDriver mockedDriver = mock(RemoteWebDriver.class);
    String mockedTitle = "Page Title";
    when(mockedDriver.getTitle()).thenReturn(mockedTitle);
    PagePlugin pagePlugin = new PagePlugin(mockedDriver);
    String currentUrl = pagePlugin.getTitle();
    verify(mockedDriver).getTitle();
    assertThat(currentUrl).isEqualTo(mockedTitle);
}
Also used : RemoteWebDriver(org.openqa.selenium.remote.RemoteWebDriver) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 100 with RemoteWebDriver

use of org.openqa.selenium.remote.RemoteWebDriver in project flue2ent by DefinityLabs.

the class PagePluginTest method getUrl_returnsWebDriverCurrentUrl.

@Test
public void getUrl_returnsWebDriverCurrentUrl() {
    RemoteWebDriver mockedDriver = mock(RemoteWebDriver.class);
    String mockedCurrentUrl = "https://google.com/a/";
    when(mockedDriver.getCurrentUrl()).thenReturn(mockedCurrentUrl);
    PagePlugin pagePlugin = new PagePlugin(mockedDriver);
    String currentUrl = pagePlugin.getUrl();
    verify(mockedDriver).getCurrentUrl();
    assertThat(currentUrl).isEqualTo(mockedCurrentUrl);
}
Also used : RemoteWebDriver(org.openqa.selenium.remote.RemoteWebDriver) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Aggregations

RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)101 URL (java.net.URL)39 Test (org.junit.Test)36 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)29 File (java.io.File)16 WebDriver (org.openqa.selenium.WebDriver)14 MalformedURLException (java.net.MalformedURLException)13 ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)13 ChromeOptions (org.openqa.selenium.chrome.ChromeOptions)12 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)12 IOException (java.io.IOException)11 Dimension (org.openqa.selenium.Dimension)9 InternetExplorerDriver (org.openqa.selenium.ie.InternetExplorerDriver)7 PhantomJSDriver (org.openqa.selenium.phantomjs.PhantomJSDriver)7 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)7 FirefoxProfile (org.openqa.selenium.firefox.FirefoxProfile)6 EventFiringWebDriver (org.openqa.selenium.support.events.EventFiringWebDriver)6 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)5 Before (org.junit.Before)5