Search in sources :

Example 11 with TextFieldElement

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

the class TestByC method testFindElementByAttribute.

@Test(groups = { "it" })
public void testFindElementByAttribute() {
    new TextFieldElement("", ByC.attribute("attr", "attribute")).sendKeys("element found by attribute");
    Assert.assertEquals(DriverTestPage.textSelectedId.getValue(), "element found by attribute");
}
Also used : TextFieldElement(com.seleniumtests.uipage.htmlelements.TextFieldElement) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 12 with TextFieldElement

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

the class TestWebUiDriver method testAttachExternalChromeBrowserStartingLate.

/**
 * Be sure that we can still attach driver even if it takes a long time to start
 * For chrome, max wait time is 1 minute
 */
@Test(groups = { "it" })
public void testAttachExternalChromeBrowserStartingLate() {
    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();
    logger.info("will start browser in 15 secs");
    new BrowserLauncher(BrowserType.CHROME, port, path, 30, null).run();
    logger.info("Waiting for driver");
    // 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 13 with TextFieldElement

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

the class TestWebUiDriver method testAttachExternalEdgeBrowser.

@Test(groups = { "it" })
public void testAttachExternalEdgeBrowser() {
    if (!SystemUtils.IS_OS_WINDOWS) {
        throw new SkipException("This test can only be done on Windows");
    }
    SeleniumTestsContextManager.getThreadContext().setTestType(TestType.WEB);
    Map<BrowserType, List<BrowserInfo>> browsers = OSUtility.getInstalledBrowsersWithVersion();
    String path = browsers.get(BrowserType.EDGE).get(0).getPath();
    int port = GenericDriverTest.findFreePort();
    // create chrome browser with the right option
    new BrowserLauncher(BrowserType.EDGE, port, path, 0, null).run();
    // creates the driver
    WebDriver driver1 = WebUIDriver.getWebDriver(true, BrowserType.EDGE, "main", port);
    driver1.get("edge://settings/");
    Assert.assertTrue(new TextFieldElement("search", By.id("search_input")).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) SkipException(org.testng.SkipException) Test(org.testng.annotations.Test) GenericDriverTest(com.seleniumtests.GenericDriverTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) ReporterTest(com.seleniumtests.it.reporter.ReporterTest)

Example 14 with TextFieldElement

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

the class TestByC method testFindElementByPartialLabelBackward.

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

Example 15 with TextFieldElement

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

the class TestByC method testFindElementByByLabelBackwardContaining.

@Test(groups = { "it" })
public void testFindElementByByLabelBackwardContaining() {
    new TextFieldElement("", ByC.labelBackward("y id back*", "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)

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