selenium.MarcosTolentino.java Source code

Java tutorial

Introduction

Here is the source code for selenium.MarcosTolentino.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package selenium;

import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

/**
 *
 * @author Marcos
 */
public class MarcosTolentino {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws InterruptedException {

        WebDriver driver = new FirefoxDriver();
        driver.get("http://www.minha.unidavi.edu.br");
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
        driver.findElement(By.id("UWS_FRM_USR_NOME")).clear();
        driver.findElement(By.id("UWS_FRM_USR_NOME")).sendKeys("32434");
        driver.findElement(By.name("UWS_FRM_USR_SENHA")).clear();
        driver.findElement(By.name("UWS_FRM_USR_SENHA")).sendKeys("537537");
        driver.findElement(By.name("acao")).click();
        driver.findElement(By.linkText("Sala Virtual")).click();
        driver.findElement(By.linkText("22014")).click();
        driver.findElement(By.xpath("//a[contains(text(),' BSN - Tpicos Avanados / Turma   4 / Fase 8')]"))
                .click();
        driver.findElement(By.linkText("Trabalhos")).click();
        driver.findElement(By.xpath("//div[@id='svMenuTrabalhos']/ul/li[5]/a/span[2]")).click();
        driver.findElement(By.xpath("//div[@id='salacontainer']/a/span[2]")).click();
        driver.findElement(By.id("titulo")).click();
        driver.findElement(By.id("titulo")).clear();
        driver.findElement(By.id("titulo")).sendKeys("testeSelenium2");
        driver.findElement(By.id("arquivo")).sendKeys("C:\\Users\\Marcos\\Desktop\\55.txt");
        driver.findElement(By.id("grupo")).click();
        new Select(driver.findElement(By.id("grupo"))).selectByVisibleText("Novo Pasta");
        driver.findElement(By.cssSelector("option[value=\"novo\"]")).click();
        driver.findElement(By.id("nomenovogrupo")).click();
        driver.findElement(By.id("nomenovogrupo")).clear();
        driver.findElement(By.id("nomenovogrupo")).sendKeys("teste4");
        driver.findElement(By.name("cadastrar")).click();
        driver.findElement(By.name("cadastrar")).click();

    }

}