Selenium之firefox瀏覽器的啟動
阿新 • • 發佈:2018-03-30
admin ive fire 瀏覽器 [] () www. 執行 org
1、編寫如下代碼
import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; /** * Created by Administrator on 2018/3/29 0029. */ public class FirefoxTest { public static void main(String[] args){ WebDriver driver; //啟動找不到firefox才需要設置 System.setProperty("webdriver.firefox.bin","D:\\ztsoft\\Firefox\\firefox.exe");//實例化一個對象firefox driver = new FirefoxDriver(); String testUrl = "http://www.baidu.com"; driver.get(testUrl); driver.quit(); }
2、執行代碼,彈出firefox,地址欄輸入代碼設置的地址。
Selenium之firefox瀏覽器的啟動