Package org.openqa.selenium.remote

Examples of org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions


*
* @author Kohsuke Kawaguchi
*/
public class Selenium2Test extends TestCase {
    public void testFoo() throws Exception {
        WebDriver wd = new RemoteWebDriver(new URL("http://127.0.0.1:4444/wd/hub"), DesiredCapabilities.firefox());
        try {
            wd.get("http://www.yahoo.com/");
            wd.findElement(By.name("p")).sendKeys("hello world");
            wd.findElement(By.id("search-submit")).click();
//        wd.waitForPageToLoad("10000");

            assertTrue(wd.getTitle().contains("hello world"));
            assertTrue(wd.getTitle().contains("Yahoo"));
        } finally {
            wd.close();
        }
    }
View Full Code Here


                        InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING,
                        false);
            }
        }

        WebDriver dr = TestBench.createDriver(new RemoteWebDriver(new URL(
                getHubURL()), capabilities));
        setDriver(dr);
    }
View Full Code Here

    }

    // FIXME: Remove this once TB4 getRemoteControlName works properly
    protected String getRemoteControlName() {
        try {
            RemoteWebDriver d = getRemoteDriver();
            if (d == null) {
                return null;
            }
            HttpCommandExecutor ce = (HttpCommandExecutor) d
                    .getCommandExecutor();
            String hostName = ce.getAddressOfRemoteServer().getHost();
            int port = ce.getAddressOfRemoteServer().getPort();
            HttpHost host = new HttpHost(hostName, port);
            DefaultHttpClient client = new DefaultHttpClient();
            URL sessionURL = new URL("http://" + hostName + ":" + port
                    + "/grid/api/testsession?session=" + d.getSessionId());
            BasicHttpEntityEnclosingRequest r = new BasicHttpEntityEnclosingRequest(
                    "POST", sessionURL.toExternalForm());
            HttpResponse response = client.execute(host, r);
            JsonObject object = extractObject(response);
            URL myURL = new URL(object.getString("proxyId"));
View Full Code Here

    @Test
    public void testCanEnhance() throws Exception {

        Unsafe unsafe = new Unsafe();
        RemoteWebDriver remoteDriver = unsafe.createInstanceWithoutInvokingConstructor(RemoteWebDriver.class);
        RemoteWebDriver reusableRemoteDriver = mock(ReusableRemoteWebDriver.class);
        DroneAugmented augmentedDriver = mock(DroneAugmented.class);
        InstanceOrCallableInstance instance1 = mock(InstanceOrCallableInstance.class);
        InstanceOrCallableInstance instance2 = mock(InstanceOrCallableInstance.class);
        InstanceOrCallableInstance instance3 = mock(InstanceOrCallableInstance.class);
        InstanceOrCallableInstance instance4 = mock(InstanceOrCallableInstance.class);
View Full Code Here

    @Test
    public void testEnhancing() {
        // given
        DesiredCapabilities capabilities = new DesiredCapabilities();
        RemoteWebDriver driver = mock(RemoteWebDriver.class);
        when(driver.getCapabilities()).thenReturn(capabilities);
        capabilities.setCapability(AugmentingEnhancer.DRONE_AUGMENTED, driver);
        capabilities.setCapability(CapabilityType.TAKES_SCREENSHOT, Boolean.TRUE);

        // when
        RemoteWebDriver enhanced = enhancer.enhance(driver, Default.class);

        // then
        assertThat(enhanced, instanceOf(DroneAugmented.class));
        assertThat(enhanced, instanceOf(TakesScreenshot.class));
        assertEquals(driver, ((DroneAugmented) enhanced).getWrapped());
View Full Code Here

    @Test
    public void testDeenhancing() {
        // given
        DesiredCapabilities capabilities = new DesiredCapabilities();
        RemoteWebDriver driver = mock(RemoteWebDriver.class);
        when(driver.getCapabilities()).thenReturn(capabilities);
        capabilities.setCapability(AugmentingEnhancer.DRONE_AUGMENTED, driver);

        // when
        RemoteWebDriver enhanced = enhancer.enhance(driver, Default.class);
        assertThat(enhanced, instanceOf(DroneAugmented.class));
        RemoteWebDriver deenhanced = enhancer.deenhance(enhanced, Default.class);

        // then
        assertEquals(driver, deenhanced);
    }
View Full Code Here

        when(configuration.getRemoteAddress()).thenReturn(hubUrl);

        // when
        fire(new BeforeSuite());

        RemoteWebDriver webdriver1 = factory1.createInstance(configuration);
        factory1.destroyInstance(webdriver1);
        webdriver1.quit();

        // then
        ReusedSession reusedSession = sessionStore.get().pull(initializationParameter);
        assertNotNull("reusedSession must be stored", reusedSession);
    }
View Full Code Here

        // when
        fire(new BeforeSuite());

        // creates new session
        RemoteWebDriver webdriver1 = factory1.createInstance(configuration);
        // persists session into store
        factory1.destroyInstance(webdriver1);
        // makes driver non-reusable
        webdriver1.quit();

        // new suite
        fire(new BeforeSuite());
        // pulls non-reusable session from store, so creates new session
        RemoteWebDriver webdriver2 = factory2.createInstance(configuration);
        // quit newly created session
        factory2.destroyInstance(webdriver2);
        webdriver2.quit();
        // persists available sessions (none should be available)
        // persistEvent.fire(new PersistReusedSessionsEvent());

        // new suite
        fire(new BeforeSuite());
View Full Code Here

    public class MockRemoteWebDriverFactory extends RemoteWebDriverFactory {

        @Override
        protected RemoteWebDriver createRemoteDriver(URL remoteAddress, Capabilities desiredCapabilities) {
            return new RemoteWebDriver(hubUrl, desiredCapabilities);
        }
View Full Code Here

        Capabilities reusedCapabilities = serializeDeserialize(ReusedSession.createReusableCapabilities(driver
                .getCapabilities()));
        SessionId reusedSessionId = new SessionId(serializeDeserialize(driver.getSessionId().toString()));

        RemoteWebDriver reusedDriver = ReusableRemoteWebDriver.fromReusedSession(HUB_URL, reusedCapabilities,
                reusedSessionId);
        reusedDriver.navigate().to(HUB_URL.toString());
    }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.