package jkcs; import java.util.Properties; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.WebDriver; import java.io.FileInputStream; public class dqpzwj { public static void main(String[] args) { // TODO Auto-generated method stub Properties pzwj = new Properties(); try { pzwj.load(new FileInputStream("src/jkcs/config.properties")); } catch(Exception e) { e.printStackTrace(); } String pzqd = pzwj.getProperty("qd"); System.out.println(pzqd); if ("firefox".contentEquals(pzqd)) { System.setProperty("webdriver.firefox.bin","C:\Program Files (x86)\Mozilla Firefox\firefox.exe"); //设置火狐的安装路径,防止系统找不到 FirefoxDriver driver = new FirefoxDriver(); //初始化FireFox浏览器实例,并打开浏览器 driver.get(pzwj.getProperty("url")); driver.get("https://www.ifeng.com"); driver.quit(); } } }