selenium 启动火狐浏览器

 2017年11月30日:

package com.selenium;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
public class seleniumDemo1 {
    public static void main(String[] args) {
        WebDriver driver = new FirefoxDriver();
        driver.get("https://www.baidu.com");
       
    }

}

这个运行能打开狐火浏览器,怎么打不开百度呢??是什么原因??

 ----------------版本不匹配-----------------------

 

 

2017年12月1日:

 

selenium 2.53.1 与 火狐浏览器 44   成功实现

 

元素定位:

id定位:

driver.findElement(By.id("kw")).sendKeys("你好吗?");

xpath定位:

driver.findElement(By.xpath(".//*[@id='kw']")).sendKeys("Xpath");

posted @ 2017-12-01 15:25  刘巨宝  阅读(534)  评论(0编辑  收藏  举报