diff --git a/src/main/ConfigureDriver.java b/src/main/ConfigureDriver.java new file mode 100644 index 0000000..67aae57 --- /dev/null +++ b/src/main/ConfigureDriver.java @@ -0,0 +1,34 @@ +package main; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.firefox.FirefoxOptions; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; + +public class ConfigureDriver { + public static WebDriver ConfigureDriver() { + WebDriver driver; + String filePath = ".user"; // Ensure the file exists in the working directory + String user = ""; + try { + user = Files.readString(Paths.get(filePath)).trim();; + System.out.println("User read: " + user); + } catch (IOException e) { + System.err.println("Error reading user file: " + e.getMessage()); + } + if (user == "xander") { + System.setProperty("webdriver.gecko.driver", "/usr/local/bin/geckodriver"); + FirefoxOptions options = new FirefoxOptions(); + options.setBinary("/usr/bin/firefox"); // Explicitly set Firefox binary + driver = new FirefoxDriver(options); + } + else { + /// DREW ADD YOUR WEB DRIVER CODE PLEASE + + } + + return driver; + } +}