List of usage examples for org.openqa.selenium WebElement click
void click();
From source file:com.daarons.transfer.UploadTask.java
License:Apache License
private void clickEmailButton() { WebElement emailButton = smallWait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector( "body > div > div > div.transfer > div > div.scrollable.transfer__contents.scrollable--overflow-top > div.scrollable__content > div.transfer__options > div.transfer__option > div > svg > path"))); String transform = getTransformAttribute(emailButton); if (!transform.equals("translate(0, 0)")) { emailButton.click(); }//from www . ja v a 2s .c o m }
From source file:com.daarons.transfer.UploadTask.java
License:Apache License
private void clickLinkButton() { WebElement linkButton = smallWait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector( "body > div > div > div.transfer > div > div.scrollable.transfer__contents.scrollable--overflow-top > div.scrollable__content > div.transfer__options > div.transfer__option > div > svg > path"))); String transform = getTransformAttribute(linkButton); if (transform.equals("translate(0, 0)")) { linkButton.click(); }/*from www .j ava 2 s. c o m*/ }
From source file:com.daarons.transfer.UploadTask.java
License:Apache License
private void logOut() { WebElement accountLink = longWait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector( "body > div > div > nav > ul > li.nav__item.nav_item--expanded.nav__item--active > ul > li:nth-child(4) > a"))); accountLink.click(); WebElement signOutButton = longWait//w w w .j a v a 2 s . c o m .until(ExpectedConditions.presenceOfElementLocated(By.className("account__signout"))); signOutButton.click(); }
From source file:com.davidgaskins.learningtounittest.Utilities.java
License:Apache License
public static void clickButton(WebDriver driver, String path) { WebElement element = getElement(driver, path); element.click(); tryToWait(timeToWait);/*from w w w .ja v a 2 s . co m*/ }
From source file:com.day.cq.social.comments.CloudServiceMTIT.java
@Test public void testConfigureTIFOnPublish() throws InterruptedException { browseTo(getURL(cloudServiceMTPage), true); WebElement tranIntegration = driver.findElement(By.cssSelector("div.product.machine-translation a")); tranIntegration.click(); assertTrue("Unable to find configuration button", isElementPresent(By.cssSelector("#machine-translation-more"))); WebElement defaultConfig = driver/*from w ww.j a v a2s . co m*/ .findElement(By.linkText("Default configuration (Translation Integration configuration)")); defaultConfig.click(); assertTrue("Unable to find go to translation integration button", isElementPresent(By.linkText("Go to Translation Integration Framework"))); assertTrue("Unable to find edit button", isElementPresent(By.id("cq-gen13"))); WebElement edit = driver.findElement(By.id("cq-gen14")); assertEquals("Edit", edit.getText()); edit.click(); assertTrue("Unable to find edit component", isElementPresent(By.id("cq-gen40"))); assertEquals("Edit Component", driver.findElement(By.id("cq-gen40")).getText()); assertEquals("Machine Translation Configuration", driver.findElement(By.id("ext-comp-1010")).getText()); assertEquals("Go to Translation Integration Framework", driver.findElement(By.cssSelector("#ext-comp-1014 a")).getText()); assertTrue("Unable to find category", isElementPresent(By.id("ext-comp-1024"))); }
From source file:com.day.cq.social.comments.CloudServiceMTIT.java
@Test public void testConfigureMSConnectorOnPublish() throws InterruptedException { browseTo(getURL(cloudServiceMTPage), true); WebElement msConnector = driver.findElement(By.cssSelector("div.product.msft-translation a")); msConnector.click(); assertTrue("Unable to find configuration button", isElementPresent(By.cssSelector("#msft-translation-more"))); assertTrue("Unable to find default configuration", isElementPresent( By.linkText("Microsoft Translator Default Configuration (Microsoft Translation Configuration)"))); assertTrue("Unable to find trail configuration", isElementPresent( By.linkText("Microsoft Translator Trial License (Microsoft Translation Configuration)"))); WebElement defaultConfig = driver.findElement( By.linkText("Microsoft Translator Default Configuration (Microsoft Translation Configuration)")); defaultConfig.click();//from w w w . j a va2s .c o m WebElement edit = driver.findElement(By.id("cq-gen14")); edit.click(); WebElement label = driver.findElement(By.cssSelector("#x-form-el-ext-comp-1021 input")); WebElement attribution = driver.findElement(By.cssSelector("#x-form-el-ext-comp-1022 input")); WebElement workspaceID = driver.findElement(By.cssSelector("#x-form-el-ext-comp-1023 input")); WebElement clientID = driver.findElement(By.cssSelector("#x-form-el-ext-comp-1024 input")); WebElement clientSecret = driver.findElement(By.cssSelector("#x-form-el-ext-comp-1025 input")); label.clear(); label.sendKeys("test"); attribution.clear(); attribution.sendKeys("test"); workspaceID.clear(); workspaceID.sendKeys("test"); clientID.clear(); clientID.sendKeys("AdobeAEMTrial"); clientSecret.clear(); clientSecret.sendKeys("AEMTrialAccount9468uTp"); WebElement verifyButton = driver.findElement(By.id("cq-gen65")); verifyButton.click(); WebElement okButton = driver.findElement(By.id("cq-gen90")); okButton.click(); okButton = driver.findElement(By.id("cq-gen44")); okButton.click(); Thread.sleep(2000); List<WebElement> property = driver.findElements(By.cssSelector("#cq-gen8 li")); Iterator it = property.iterator(); it.next(); assertEquals("Translation Label: test", ((WebElement) it.next()).getText()); }
From source file:com.demo.selenium.example.GridExampleTest.java
License:Apache License
@Test public void GridTwoNodeTest() throws MalformedURLException, InterruptedException { DesiredCapabilities aDesiredcap = DesiredCapabilities.chrome(); WebDriver dr = new RemoteWebDriver(new URL("http://172.19.6.46:5555/wd/hub"), aDesiredcap); dr.get("http://www.baidu.com"); dr.manage().window().maximize();/*from w w w. ja v a 2 s . co m*/ String str[] = new String[] { "java", "selenium", "spring", "mybatis", "jps", "grid", "mysql", "iphone" }; for (String string : str) { WebElement element = dr.findElement(By.xpath(".//*[@id='kw']")); element.clear(); element.sendKeys(string); Thread.sleep(1000); WebElement buttons = dr.findElement(By.xpath(".//*[@id='su']")); System.out.println(buttons.getTagName()); buttons.click(); } Thread.sleep(2000); dr.close(); }
From source file:com.dhenton9000.selenium.d3.D3Tests.java
private void gotoD3Page() { this.getAutomation().maximizeWindow(); WebElement backboneD3Link = this.getAutomation() .findElement(GenericAutomationRepository.SELECTOR_CHOICE.partialLinkText, "Backbone and D3"); backboneD3Link.click(); this.getAutomation().getWaitMethods().waitForElementToBeClickable(2, SELECTOR_CHOICE.linkText, "D3 Demos"); WebElement d3Hover = getAutomation().findElement(SELECTOR_CHOICE.linkText, "D3 Demos"); assertNotNull(d3Hover);/*from ww w. j a va2s . c om*/ assertEquals("D3 Demos", d3Hover.getText()); this.getAutomation().hoverOn(d3Hover); this.getAutomation().getWaitMethods().waitForElementToBeClickable(2, SELECTOR_CHOICE.linkText, "Tree Demo"); this.getAutomation().findElement(SELECTOR_CHOICE.linkText, "Tree Demo").click(); }
From source file:com.digi.selenium.util.BillNReload.Bill_n_Reload_Prepaid_Broadband_Util.java
protected void target_reloadbtn() { JavascriptExecutor jse = (JavascriptExecutor) getDriver(); jse.executeScript("window.scrollBy(0,-500)", ""); boolean breakIt; jse.executeScript("window.scrollBy(0,400)", ""); while (true) { breakIt = true;/*w ww. java2 s. com*/ try { //*[@id="planDetails"]/div[2]/div[1]/div[4]/a WebElement reload = getDriver().findElement(By.linkText("Reload balance")); reload.click(); log.info("Success: Reload button is clicked"); waitForPageLoad(100); } catch (Exception e) { log.error("Fail : Failed to click on reload button"); breakIt = false; //System.out.println(e); //e.printStackTrace(); //e.printStackTrace(); //System.exit(0); } if (breakIt) { break; } } }
From source file:com.digi.selenium.util.BillNReload.Bill_n_Reload_Prepaid_Broadband_Util.java
protected void clickOnRadioRM50() { boolean breakIt; while (true) { breakIt = true;/*from w w w. j ava 2 s .com*/ try { // Put email id on text field as it can not be blank //*[@id="reloadForm__email"] WebElement emailtxt = getDriver().findElement(By.id("reloadForm__email")); System.out.println(emailtxt.isEnabled()); if (emailtxt.isEnabled()) { handleInputField_ByID("reloadForm__email", AppConstants.EMAIL); Thread.sleep(500); } JavascriptExecutor js1 = (JavascriptExecutor) getDriver(); //js1.executeScript("window.scrollBy(0,400)", ""); //*[@id="prepaidReloadForm"]/ul/li[2]/label/div WebElement radio = getDriver() .findElement(By.xpath("//*[@id='prepaidReloadForm']/ul/li[4]/label/div")); radio.click(); // now select check box to accept license agreement WebElement checkbox = getDriver().findElement(By.xpath("//*[@id='prepaidReloadForm']/label/div")); checkbox.click(); // click on proceed button after selecting radio button and check box // WebElement elementproceed=getDriver().findElement(By.xpath("//*[@id='proceedBtn']")); //*[@id="proceedBtn"] WebElement proceed = (new WebDriverWait(getDriver(), 1000)) .until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id='proceedBtn']"))); proceed.click(); waitForPageLoad(100); Thread.sleep(500); JavascriptExecutor js = (JavascriptExecutor) getDriver(); js.executeScript("window.scrollBy(0,500)", ""); } catch (Exception e) { System.out.println(e); breakIt = false; e.printStackTrace(); log.error("Fail : Failed to Reload amount."); System.exit(0); } if (breakIt) { break; } } //while ends }