当前位置: 首页>>代码示例>>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;未经允许,请勿转载。