當前位置: 首頁>>代碼示例>>Java>>正文


Java WebElement.submit方法代碼示例

本文整理匯總了Java中org.openqa.selenium.WebElement.submit方法的典型用法代碼示例。如果您正苦於以下問題:Java WebElement.submit方法的具體用法?Java WebElement.submit怎麽用?Java WebElement.submit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openqa.selenium.WebElement的用法示例。


在下文中一共展示了WebElement.submit方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: editANodeWithEditor

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
public void editANodeWithEditor() throws Throwable {
    System.err.println("Ignore the following NPE. The DynamicTree class has a bug");
    WebElement tree = page.getTree();
    tree.click();
    final WebElement root = tree.findElement(By.cssSelector(".::root"));
    AssertJUnit.assertEquals("Root Node", root.getText());
    WebElement editor = root.findElement(By.cssSelector(".::editor"));
    editor.clear();
    editor.sendKeys("Hello World", Keys.ENTER);
    root.submit();
    new WebDriverWait(driver, 3).until(new Function<WebDriver, Boolean>() {
        @Override public Boolean apply(WebDriver input) {
            return root.getText().equals("Hello World");
        }
    });
    AssertJUnit.assertEquals("Hello World", root.getText());
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:18,代碼來源:JTreeDynamicTreeTest.java

示例2: nodeEditor

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
public void nodeEditor() throws Throwable {
    System.err.println("Ignore the following NPE. The DynamicTree class has a bug");
    WebElement tree = page.getTree();
    tree.click();
    WebElement root = tree.findElement(By.cssSelector(".::nth-node(1)"));
    AssertJUnit.assertEquals("Root Node", root.getText());
    WebElement editor = root.findElement(By.cssSelector(".::editor"));
    editor.clear();
    editor.sendKeys("Hello World", Keys.ENTER);
    root.submit();
    AssertJUnit.assertEquals("Hello World", root.getText());
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:13,代碼來源:JTreeDynamicTreeTest.java

示例3: elementSubmit

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
public void elementSubmit() throws Throwable {
    driver = new JavaDriver();
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
    WebElement element1 = driver.findElement(By.name("click-me"));
    element1.submit();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:12,代碼來源:JavaDriverTest.java

示例4: getOppositeUser

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
private static String getOppositeUser(String transactionNo) {
	// ��ȡ�ؼ��ֶ�Ӧ��������
	WebElement keywordInput = driver.findElement(By.id("J-keyword"));
	keywordInput.clear();
	keywordInput.sendKeys(transactionNo);
	WebElement keywordSelect = driver.findElement(By.id("keyword"));
	List<WebElement> options = keywordSelect.findElements(By.tagName("option"));
	// until������ʾֱ���ɵ��ٵ�
	// WebElement selectElement = wait.until(ExpectedConditions
	// .visibilityOfElementLocated(By.id("keyword")));
	// ��Ҫִ��JavaScript��䣬����ǿתdriver
	JavascriptExecutor js = (JavascriptExecutor) driver;
	// Ҳ������ô��setAttribute("style","");
	js.executeScript("document.getElementById('keyword').style.display='list-item';");
	js.executeScript("document.getElementById('keyword').removeAttribute('smartracker');");
	js.executeScript("document.getElementById('keyword').options[1].selected = true;");
	js.executeScript("document.getElementById('J-select-range').style.display='list-item';");
	// ���ý���ʱ��ѡ��
	Select selectTime = new Select(driver.findElement(By.id("J-select-range")));
	selectTime.selectByIndex(3);// ѡ�е������������
	System.out.println("selectTime.isMultiple() : " + selectTime.isMultiple());
	// ���ùؼ���ѡ��
	Select selectKeyword = new Select(driver.findElement(By.id("keyword")));
	// selectKeyword.selectByValue("bizInNo");//�˴���value��д<option>��ǩ�е�valueֵ
	selectKeyword.selectByIndex(1);// ѡ�е��ǽ��׺�
	System.out.println("selectKeyword.isMultiple() : " + selectKeyword.isMultiple());
	WebElement queryButton = driver.findElement(By.id("J-set-query-form"));// �õ�������ť
	// ���������ť
	queryButton.submit();
	WebElement tr = driver.findElement(By.id("J-item-1"));// �Ȼ�ȡtr
	WebElement td = tr.findElement(By.xpath("//*[@id=\"J-item-1\"]/td[5]/p[1]"));
	return td.getText();
}
 
開發者ID:qwl-nju,項目名稱:AlipayAuto,代碼行數:34,代碼來源:AlipayAuto.java

示例5: username_and_password_are_given

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
@When("^username \"([^\"]*)\" and password \"([^\"]*)\" are given$")
public void username_and_password_are_given(String username, String password) throws Throwable {
    WebElement element = driver.findElement(By.name("username"));
    element.sendKeys(username);
    element = driver.findElement(By.name("password"));
    element.sendKeys(password);
    element = driver.findElement(By.name("login"));
    element.submit();  
}
 
開發者ID:mluukkai,項目名稱:ohjelmistotuotanto2017,代碼行數:10,代碼來源:Stepdefs.java

示例6: logInWith

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
private void logInWith(String username, String password) {
    assertTrue(driver.getPageSource().contains("Give your credentials to login"));
    WebElement element = driver.findElement(By.name("username"));
    element.sendKeys(username);
    element = driver.findElement(By.name("password"));
    element.sendKeys(password);
    element = driver.findElement(By.name("login"));
    element.submit();  
}
 
開發者ID:mluukkai,項目名稱:ohjelmistotuotanto2017,代碼行數:10,代碼來源:Stepdefs.java

示例7: submit

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
@Override
public void submit(Element ele)
{
	WebElement webEle = searchStrategyUtils.findStrategy(WebElement.class, ele).search(ele);
	webEle.submit();
}
 
開發者ID:LinuxSuRen,項目名稱:phoenix.webui.framework,代碼行數:7,代碼來源:SeleniumValueEditor.java

示例8: cadastro

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
@Test
    public void cadastro() throws InterruptedException {

        WebDriverWait wait = new WebDriverWait(driver, 30);

        wait.until(ExpectedConditions.presenceOfElementLocated(By.id("Name")));
        WebElement name = driver.findElement(By.id("Name"));
        name.sendKeys("Vitor Cardoso");

        wait.until(ExpectedConditions.presenceOfElementLocated(By.id("Email")));
        WebElement email = driver.findElement(By.id("Email"));
        email.sendKeys(("[email protected]"));

        wait.until(ExpectedConditions.presenceOfElementLocated(By.id("Site")));
        WebElement site = driver.findElement(By.id("Site"));
        site.sendKeys("www.doqconsulting.com.br");

        wait.until(ExpectedConditions.presenceOfElementLocated(By.id("Subject")));
        WebElement assunto = driver.findElement(By.id("Subject"));
        assunto.sendKeys("Teste Selenium com assert");

        wait.until(ExpectedConditions.presenceOfElementLocated(By.id("Message")));
        WebElement message = driver.findElement(By.id("Message"));
        message.sendKeys
                ("Gostaria de saber mais sobre a DOQ Consulting e como podemos ajudá-lo? Envie sua mensagem pelo site ou em nossas redes sociais.");

        // SUBMIT AND ASSERT
        name.submit();
        String respname = name.getAttribute("value");
        Assert.assertEquals(respname,"Vitor Cardoso");

        email.submit();
        String resp = email.getAttribute("value");
        Assert.assertEquals(resp,"[email protected]");

        site.submit();
        String respsite = site.getAttribute("value");
        Assert.assertEquals(respsite,"www.doqconsulting.com.br");

        assunto.submit();
        String respassunto = assunto.getAttribute("value");
        Assert.assertEquals(respassunto,"Teste Selenium com assert");

        message.submit();
        String respmsg = message.getAttribute("value");
        Assert.assertEquals(respmsg,
                "Gostaria de saber mais sobre a DOQ Consulting e como podemos ajudá-lo? Envie sua mensagem pelo site ou em nossas redes sociais.");

        wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("button[class='btn btn-send']")));
        WebElement sendclick = driver.findElement(By.cssSelector("button[class='btn btn-send']"));
        sendclick.click(); /*Código comentado devido ao erro do webdriver com o firefox*/

//        wait.until(ExpectedConditions.presenceOfElementLocated(By.className("col-sm-7 col-sm-offset-1")));
//        WebElement validatemsg = driver.findElement(By.className("col-sm-7 col-sm-offset-1"));
//        String test = validatemsg.getText();
//        Assert.assertEquals(test," *Sua mensagem foi enviada com sucesso, logo mais um de nosso consultores irão avaliar o seu caso e entrar em contato. ");


    }
 
開發者ID:vitorc,項目名稱:QA_Begin,代碼行數:60,代碼來源:TestContactDoq.java

示例9: main

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
public static void main(String[] args) {
    WebDriver driver = new ChromeDriver();

    driver.get("http://localhost:4567");
    
    sleep(2);
    
    WebElement element = driver.findElement(By.linkText("login"));
    element.click();

    sleep(2);

    element = driver.findElement(By.name("username"));
    element.sendKeys("pekka");
    element = driver.findElement(By.name("password"));
    element.sendKeys("akkep");
    element = driver.findElement(By.name("login"));
    
    sleep(2);
    element.submit();

    sleep(3);
    
    driver.quit();
}
 
開發者ID:mluukkai,項目名稱:ohjelmistotuotanto2017,代碼行數:26,代碼來源:Tester.java


注:本文中的org.openqa.selenium.WebElement.submit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。