List of usage examples for org.openqa.selenium WebElement getAttribute
String getAttribute(String name);
From source file:com.mkl.websuites.internal.command.impl.select.SelectCheckboxCommand.java
License:Apache License
@Override protected void doOperationOnElement(WebElement elem) { if (!CommandUtils.checkIfElementIsCheckBox(elem)) { fail(String.format("Element picked by selector '%s' must be an INPUT[type=CHECKBOX], but is '%s'", by, elem.getTagName() + "[type=" + elem.getAttribute("type") + "]")); }//from w ww. j a v a 2s . c o m selectCheckbox(elem); }
From source file:com.mroza.seleniumTests.EditProgramViewTests.EditProgramViewPage.java
License:Open Source License
private WebElement getTableWithHeader(String header, Boolean isEditing) { List<WebElement> tablesList = getTablesList(); for (WebElement table : tablesList) { WebElement tableHeader = table.findElement(By.className("ui-datatable-header")); if (isEditing) { WebElement tableHeaderInput = tableHeader.findElement(By.tagName("input")); if (tableHeaderInput.getAttribute("value").equals(header)) return table; } else if (tableHeader.getText().equals(header)) return table; }/*w w w. ja v a 2s . com*/ return null; }
From source file:com.mroza.seleniumTests.KidProgramsViewTests.KidProgramsForPeriodViewPage.java
License:Open Source License
public String getActualChosenPeriodEndDate() { WebElement input = getPeriodDateInput(3); return input.getAttribute("value"); }
From source file:com.mroza.seleniumTests.KidProgramsViewTests.KidProgramsForPeriodViewPage.java
License:Open Source License
public String getActualChosenPeriodStartDate() { WebElement input = getPeriodDateInput(1); return input.getAttribute("value"); }
From source file:com.mroza.seleniumTests.MrozaViewPage.java
License:Open Source License
protected WebElement getVisibleDialogBox() { List<WebElement> dialogs = driver.findElements(By.className("ui-dialog")); WebElement goodDialog = null;//ww w .j a va 2 s . co m SeleniumWaiter.waitForDialogBoxAppears(driver); for (WebElement dialog : dialogs) { if (dialog.getAttribute("aria-hidden").equals("false")) goodDialog = dialog; } return goodDialog; }
From source file:com.mroza.seleniumTests.NewProgramsViewTests.NewProgramsViewPage.java
License:Open Source License
public String getSymbol() { WebElement symbolInputField = getInputFieldNamed(Utils.getMsgFromResources("newProgramsView.symbol")); return symbolInputField.getAttribute("value"); }
From source file:com.mroza.seleniumTests.NewProgramsViewTests.NewProgramsViewPage.java
License:Open Source License
public String getName() { WebElement nameInputField = getInputFieldNamed(Utils.getMsgFromResources("newProgramsView.name")); return nameInputField.getAttribute("value"); }
From source file:com.mvnsnm.Tabviews.java
public void campaign() { WebElement tabhome = driver.findElement(By.xpath("//a[@id='ui-id-1']")); final String text_a = "Home"; Assert.assertEquals(text_a, tabhome.getText()); driver.findElement(By.id("ui-id-2")).click(); driver.findElement(By.xpath("//input[@id='campname']")).sendKeys("Hello Test"); WebElement select = driver.findElement(By.xpath("//select[@id='lstkeyword']")); List<WebElement> allOptions = select.findElements(By.tagName("option")); for (WebElement option : allOptions) { System.out.println(String.format("Value is: %s", option.getAttribute("value"))); String optval = option.getAttribute("value"); if (optval.equals("103")) { option.click();/*w w w . j a va2s .c o m*/ } } //smsmessage smssendtime smssubmit WebElement msg = driver.findElement(By.xpath("//textarea[@id='smsmessage']")); msg.sendKeys("This message bodey was set from selenium automation and should save in db"); WebElement sendtime = driver.findElement(By.xpath("//input[@id='smssendtime']")); sendtime.sendKeys("2015/02/04 10:30:00"); WebElement submit = driver.findElement(By.xpath("//input[@id='smssubmit']")); submit.click(); WebElement chweekly = driver.findElement(By.xpath("//input[@id='weekly']")); chweekly.click(); WebElement monthslct = driver.findElement(By.xpath("//select[@id='weekofmonth']")); List<WebElement> weekopt = monthslct.findElements(By.tagName("option")); for (WebElement option : weekopt) { System.out.println(String.format("Value is: %s", option.getAttribute("value"))); String optval = option.getAttribute("value"); if (optval.equals("3")) { option.click(); } } //createmoremsg WebElement weekmsg = driver.findElement(By.xpath("//textarea[@id='createmoremsg']")); weekmsg.sendKeys("This message bodey was set for weekly report and can be saved in db"); //moremsgsave WebElement more_msg = driver.findElement(By.xpath("//input[@id='moremsgsave']")); more_msg.click(); chweekly.click(); WebElement monthly = driver.findElement(By.xpath("//input[@id='monthly']")); monthly.click(); WebElement monthofyear = driver.findElement(By.xpath("//select[@id='monthofyear']")); List<WebElement> monthopt = monthofyear.findElements(By.tagName("option")); for (WebElement option : monthopt) { System.out.println(String.format("Value is: %s", option.getAttribute("value"))); String optval = option.getAttribute("value"); if (optval.equals("7")) { option.click(); } } //createmoremsg WebElement monthlymsg = driver.findElement(By.xpath("//textarea[@id='monthlymsgmore']")); monthlymsg.sendKeys("This message bodey was set for weekly report and can be saved in db"); //moremsgsave WebElement monthlymsgsave = driver.findElement(By.xpath("//input[@id='monthlymsgsave']")); monthlymsgsave.click(); monthly.click(); }
From source file:com.mycompany.myproject.sample.simple.DemoMobileTest.java
License:Apache License
@Test @MobileTest(appPath = TEST_APP_PATH, device = "android:19") public void testNative() { RemoteWebDriver driver = Grid.driver(); WebDriverWaitUtils.waitUntilElementIsVisible("io.selendroid.testapp:id/my_text_field"); SeLionReporter.log("Main page", true, true); WebElement textField = driver.findElement(By.id("io.selendroid.testapp:id/my_text_field")); assertEquals("true", textField.getAttribute("enabled")); textField.sendKeys("Appium Android Native Test"); SeLionReporter.log("Entered text", true, true); assertEquals("Appium Android Native Test", textField.getText()); }
From source file:com.mycompany.myselion.sample.selion.AppiumAndroidDemoTest.java
License:Apache License
/** * This test demonstrates how to use SeLion for running tests against a Native ANDROID app using appium. * <ul>//from ww w .j a v a 2s . co m * <li> * An appium instance/server should be locally installed and running and point SeLion to this server using any of the following options. * <ol> * <li>Through the JVM arguments -DSELION_SELENIUM_HOST and -DSELION_SELENIUM_PORT </li> (or) * <li>Through suite file <parameter name="seleniumhost" value=""/> and <parameter name="seleniumport" value=""/></li> * </ol></li> * <li> * For setting up Appium Android refer http://appium.io/slate/en/master/?ruby#system-setup-(android) * </li> * </ul> */ @Test @MobileTest(appPath = "src/test/resources/apps/selendroid-test-app-0.15.0.apk", device = "android:5.0.1", deviceType = "Android Emulator") public void testWithNativeApp() { RemoteWebDriver driver = Grid.driver(); WebDriverWaitUtils.waitUntilElementIsVisible("io.selendroid.testapp:id/my_text_field"); WebElement textField = driver.findElement(By.id("io.selendroid.testapp:id/my_text_field")); assertEquals("true", textField.getAttribute("enabled")); textField.sendKeys("Appium Android Native Test"); assertEquals("Appium Android Native Test", textField.getText()); }