Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.io.*;
- import java.text.*;
- import org.openqa.selenium.By;
- import org.openqa.selenium.WebDriver;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.firefox.FirefoxDriver;
- import org.openqa.selenium.support.ui.ExpectedCondition;
- import org.openqa.selenium.support.ui.WebDriverWait;
- public class FinalProject{
- public static void main(String[] args) throws IOException{
- Random random = new Random();
- String[] correctAnswers = new String[10];
- String[] userAnswers = new String[10];
- int score = 0, time_elapsed = 0, questionNum;
- WebDriver driver = new FirefoxDriver();
- Scanner sc = new Scanner(System.in);
- System.out.println("Enter your username: ");
- String userName = sc.next();
- System.out.println("Enter your password: ");
- String password = sc.next();
- BufferedReader in = new BufferedReader(new FileReader(new File("UsersInfo_101.txt")));
- String strline;
- int count = 0; count++;
- while((strline = in.readLine()) != null) {
- WebElement user = driver.findElement(By.id("username"));
- WebElement pass = driver.findElement(By.id("password"));
- for(int i = 0; i <= 3; i++){
- if(userName.equalsIgnoreCase(user.toString()) && password.equals(pass.toString())){
- BufferedReader br = new BufferedReader(new FileReader(new File("TestBank.txt")));
- BufferedReader an = new BufferedReader(new FileReader(new File("Answers.txt")));
- for(int j = 0; j < 10; j++){
- questionNum = random.nextInt(125)+1;
- for(int k = 0; k < (questionNum-1); k++){
- br.readLine();
- an.readLine();
- }
- System.out.println(br.readLine().toString());
- correctAnswers[j] = an.readLine().toString();
- userAnswers[j] = sc.next();
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement