List of usage examples for org.openqa.selenium By name
public static By name(String name)
From source file:com.nowsprinting.hellotesting.appiumtest.selendroid.page.SelendroidDetailPage.java
License:Apache License
@Override public DetailPage selectGender(Gender gender) { /*/*from w w w . j a v a 2 s . c o m*/ * --------------------------- * RadioGroup (contentDescription="gender segmentedcontrol") * RadioButton ("") * RadioButton ("") * --------------------------- * ??????????? * contentDescrption?"gender segmentedcontrol"??????? * ???????????? */ if (gender != null) { WebElement genderRadioGroup = mDriver.findElement(By.name("gender segmentedcontrol")); genderRadioGroup.findElement(By.linkText(gender.getRadioButtonText())).click(); } return this; }
From source file:com.nowsprinting.hellotesting.appiumtest.selendroid.page.SelendroidDetailPage.java
License:Apache License
@Override public PreviewPage saveAndPreview() { mDriver.findElement(By.name("preview")).click(); PreviewPage newPage = new PreviewPage(mDriver); assertTrue(newPage.waitUntilLoad()); return newPage; }
From source file:com.nowsprinting.hellotesting.appiumtest.selendroid.page.SelendroidMasterPage.java
License:Apache License
@Override public DetailPage goDetailPageToAddCustomer() { // Accessibility ID (= Android??contentDescription) // ?"add"??UI???? WebElement addButton = mDriver.findElement(By.name("add")); addButton.click();/*from w w w.ja v a 2 s. c o m*/ DetailPage detailPage = new SelendroidDetailPage(mDriver); assertTrue(detailPage.waitUntilLoad()); return detailPage; }
From source file:com.numenta.htmit.mobile.test.behavior.TestUtilities.java
License:Open Source License
public static void checkGraph(String locator, WebDriver driver, int value) { By name = By.name(locator); waitClick(name, driver, value);// www . j av a 2s . c om waitClick(INSTANCE, driver, value); waitClick(INSTANCE_METRIC, driver, value); waitClick(DATE, driver, value); }
From source file:com.numenta.htmit.mobile.test.behavior.TestUtilities.java
License:Open Source License
public static void checkTabs(String locator, WebDriver driver, int value) { By name = By.name(locator); waitClick(name, driver, value); }
From source file:com.openones.auto.selen.Sample01.java
License:Apache License
public static void main(String[] args) { // Create a new instance of the Firefox driver // Notice that the remainder of the code relies on the interface, // not the implementation. WebDriver driver = new FirefoxDriver(); //WebDriver driver = new InternetExplorerDriver(); // And now use this to visit Google driver.get("http://www.google.com"); // Alternatively the same thing can be done like this // driver.navigate().to("http://www.google.com"); // Find the text input element by its name WebElement element = driver.findElement(By.name("q")); // Enter something to search for element.sendKeys("Cheese!"); // Now submit the form. WebDriver will find the form for us from the element element.submit();//ww w .ja va2 s .com // Check the title of the page System.out.println("Page title is: " + driver.getTitle()); // Google's search is rendered dynamically with JavaScript. // Wait for the page to load, timeout after 10 seconds (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver d) { return d.getTitle().toLowerCase().startsWith("cheese!"); } }); // Should see: "cheese! - Google Search" System.out.println("Page title is: " + driver.getTitle()); //Close the browser driver.quit(); }
From source file:com.opera.core.systems.FormSubmissionTest.java
License:Apache License
@Before public void setup() { driver.get(pages.form); input = driver.findElement(By.name("result")); submit = driver.findElement(By.id("submit")); }
From source file:com.owncloud.android.test.ui.testSuites.UploadTestSuite.java
License:Open Source License
@Test @Category(UnfinishedTestCategory.class) public void testUploadFromGmail() throws Exception { FileListView fileListView = Actions.login(Config.URL, Config.user, Config.password, Config.isTrusted, driver);//w w w . j ava 2 s . c o m driver.startActivity("com.google.android.gm", ".ConversationListActivityGmail"); GmailEmailListView gmailEmailListView = new GmailEmailListView(driver); Thread.sleep(3000); GmailEmailView gmailEmailView = gmailEmailListView.clickOnEmail(); ImageView imageView = gmailEmailView.clickOnfileButton(); imageView.clickOnOptionsButton(); imageView.clickOnShareButton(); imageView.clickOnOwnCloudButton(); //justonce button do not appear always try { imageView.clickOnJustOnceButton(); } catch (NoSuchElementException e) { } UploadView uploadView = new UploadView(driver); uploadView.clickOUploadButton(); driver.sendKeyEvent(android.view.KeyEvent.KEYCODE_HOME); driver.startActivity("com.owncloud.android", ".ui.activity.FileDisplayActivity"); common.wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.name(FILE_GMAIL_NAME))); assertEquals(Config.fileToTestSendByEmailName, driver.findElementByName(FILE_GMAIL_NAME).getText()); fileListView = new FileListView(driver); fileListView.scrollTillFindElement(FILE_GMAIL_NAME); assertTrue(fileHasBeenUploadedFromGmail = fileListView.getFileElement().isDisplayed()); //TODO. correct assert if fileListView is shown in grid mode }
From source file:com.pentaho.ctools.cde.reference.AddinReferenceEdit.java
License:Apache License
/** * * @param value//from w w w . j a v a 2 s . c om */ private void ChangeFontSize(String value) { this.log.info("ChangeFontSize"); driver.get(PageUrl.ADDIN_REFERENCE_EDIT); //Expand first row - Title this.elemHelper.ClickJS(driver, By.xpath("//table[@id='table-cdfdd-layout-tree']/tbody/tr[5]/td/span")); //Click in HTML to open the Properties Actions acts = new Actions(driver); acts.click(this.elemHelper.FindElement(driver, By.xpath("//table[@id='table-cdfdd-layout-tree']/tbody/tr[6]/td[1]"))); acts.build().perform(); //Click in field 'Font Size' to be editable this.elemHelper.ClickJS(driver, By.xpath("//table[@id='table-cdfdd-layout-properties']/tbody/tr[3]/td[2]")); //Write 34 this.elemHelper.FindElement(driver, By.name("value")).clear(); this.elemHelper.SendKeys(driver, By.name("value"), value); this.elemHelper.FindElement(driver, By.name("value")).submit(); this.bFontChanged = true; //Save the changes this.elemHelper.ClickJS(driver, By.linkText("Save")); //Wait for element present and invisible this.elemHelper.WaitForElementVisibility(driver, By.xpath("//div[@id='notifyBar']")); this.elemHelper.WaitForElementInvisibility(driver, By.xpath("//div[@id='notifyBar']")); }
From source file:com.pentaho.ctools.cde.require.AddinReferenceEdit.java
License:Apache License
/** * * @param value//from w w w . j av a2 s. com */ private void ChangeFontSize(String value) { this.log.info("ChangeFontSize"); driver.get(PageUrl.ADDIN_REFERENCE_REQUIRE_EDIT); //Expand first row - Title this.elemHelper.ClickJS(driver, By.xpath("//table[@id='table-cdfdd-layout-tree']/tbody/tr[5]/td/span")); //Click in HTML to open the Properties Actions acts = new Actions(driver); acts.click(this.elemHelper.FindElement(driver, By.xpath("//table[@id='table-cdfdd-layout-tree']/tbody/tr[6]/td[1]"))); acts.build().perform(); //Click in field 'Font Size' to be editable this.elemHelper.ClickJS(driver, By.xpath("//table[@id='table-cdfdd-layout-properties']/tbody/tr[3]/td[2]")); //Write 34 this.elemHelper.FindElement(driver, By.name("value")).clear(); this.elemHelper.SendKeys(driver, By.name("value"), value); this.elemHelper.FindElement(driver, By.name("value")).submit(); this.bFontChanged = true; //Save the changes this.elemHelper.ClickJS(driver, By.linkText("Save")); //Wait for element present and invisible this.elemHelper.WaitForElementVisibility(driver, By.xpath("//div[@id='notifyBar']")); this.elemHelper.WaitForElementInvisibility(driver, By.xpath("//div[@id='notifyBar']")); }