Search in sources :

Example 1 with TextFieldElement

use of com.seleniumtests.uipage.htmlelements.TextFieldElement in project seleniumRobot by bhecquet.

the class TestWebUiDriver method testAttachExternalChromeBrowser.

/**
 * Check we can attach Selenium to a chrome process if it's launched with '--remote-debugging-port' option
 */
@Test(groups = { "it" })
public void testAttachExternalChromeBrowser() {
    SeleniumTestsContextManager.getThreadContext().setTestType(TestType.WEB);
    Map<BrowserType, List<BrowserInfo>> browsers = OSUtility.getInstalledBrowsersWithVersion();
    String path = browsers.get(BrowserType.CHROME).get(0).getPath();
    int port = GenericDriverTest.findFreePort();
    // create chrome browser with the right option
    new BrowserLauncher(BrowserType.CHROME, port, path, 0, null).run();
    // creates the driver
    WebDriver driver1 = WebUIDriver.getWebDriver(true, BrowserType.CHROME, "main", port);
    driver1.get("chrome://settings/");
    Assert.assertTrue(new TextFieldElement("search", By.id("search")).isElementPresent(3));
}
Also used : WebDriver(org.openqa.selenium.WebDriver) CustomEventFiringWebDriver(com.seleniumtests.driver.CustomEventFiringWebDriver) TextFieldElement(com.seleniumtests.uipage.htmlelements.TextFieldElement) BrowserType(com.seleniumtests.driver.BrowserType) List(java.util.List) ArrayList(java.util.ArrayList) Test(org.testng.annotations.Test) GenericDriverTest(com.seleniumtests.GenericDriverTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) ReporterTest(com.seleniumtests.it.reporter.ReporterTest)

Example 2 with TextFieldElement

use of com.seleniumtests.uipage.htmlelements.TextFieldElement in project seleniumRobot by bhecquet.

the class TestFrameElement method testTextFieldElementInsideFrame.

@Test(groups = { "ut" })
public void testTextFieldElementInsideFrame() throws Exception {
    FrameElement frame = new FrameElement("", By.id("frameId"));
    TextFieldElement el = new TextFieldElement("", By.id("el"), frame);
    el.sendKeys("toto");
    verify(locator).frame(any(WebElement.class));
    verify(locator).defaultContent();
}
Also used : TextFieldElement(com.seleniumtests.uipage.htmlelements.TextFieldElement) FrameElement(com.seleniumtests.uipage.htmlelements.FrameElement) WebElement(org.openqa.selenium.WebElement) RemoteWebElement(org.openqa.selenium.remote.RemoteWebElement) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 3 with TextFieldElement

use of com.seleniumtests.uipage.htmlelements.TextFieldElement in project seleniumRobot by bhecquet.

the class TestByC method testFindElementByByLabelBackwardEnding.

@Test(groups = { "it" })
public void testFindElementByByLabelBackwardEnding() {
    new TextFieldElement("", ByC.labelBackward(" id backward$", "input")).sendKeys("element found by label backward$");
    Assert.assertEquals(DriverTestPage.textSelectedText.getValue(), "element found by label backward$");
}
Also used : TextFieldElement(com.seleniumtests.uipage.htmlelements.TextFieldElement) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 4 with TextFieldElement

use of com.seleniumtests.uipage.htmlelements.TextFieldElement in project seleniumRobot by bhecquet.

the class TestByC method testFindElementByLabelForward.

public void testFindElementByLabelForward(String labelToSearch) {
    new TextFieldElement("", ByC.labelForward(labelToSearch, "input")).sendKeys("element found by label");
    Assert.assertEquals(DriverTestPage.textSelectedId.getValue(), "element found by label");
}
Also used : TextFieldElement(com.seleniumtests.uipage.htmlelements.TextFieldElement)

Example 5 with TextFieldElement

use of com.seleniumtests.uipage.htmlelements.TextFieldElement in project seleniumRobot by bhecquet.

the class TestByC method testFindElementByCustomLabelBackward.

@Test(groups = { "it" })
public void testFindElementByCustomLabelBackward() {
    new TextFieldElement("", ByC.labelBackward("Test select Multiple", "input", "h3")).sendKeys("element found by h3 tag backward");
    Assert.assertEquals(DriverTestPage.textSelectedText.getValue(), "element found by h3 tag backward");
}
Also used : TextFieldElement(com.seleniumtests.uipage.htmlelements.TextFieldElement) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Aggregations

TextFieldElement (com.seleniumtests.uipage.htmlelements.TextFieldElement)26 Test (org.testng.annotations.Test)25 GenericTest (com.seleniumtests.GenericTest)20 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 GenericDriverTest (com.seleniumtests.GenericDriverTest)3 BrowserType (com.seleniumtests.driver.BrowserType)3 CustomEventFiringWebDriver (com.seleniumtests.driver.CustomEventFiringWebDriver)3 ReporterTest (com.seleniumtests.it.reporter.ReporterTest)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 WebDriver (org.openqa.selenium.WebDriver)3 MockitoTest (com.seleniumtests.MockitoTest)2 WebElement (org.openqa.selenium.WebElement)2 RemoteWebElement (org.openqa.selenium.remote.RemoteWebElement)2 FrameElement (com.seleniumtests.uipage.htmlelements.FrameElement)1 SkipException (org.testng.SkipException)1