JS使用htef访问html文件,selenium phantomjs java×××面浏览器环境搭建

java selenium搭建×××面浏览器

下载windows版phantomjs

af5185a78fe28c94f0a0eb14656198cd.png

fce3962f2fe847c72cbf171d0c031e1e.png

2.解压后bin目录下会有exe文件

dbc3b8b83175280640d8842c29c788aa.png

3.测试代码:

复制代码

package se;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

import org.openqa.selenium.phantomjs.PhantomJSDriver;

public class test {

public static void main(String[] args) {

// TODO Auto-generated method stub

// System.setProperty("webdriver.gecko.driver", "C:Program Files (x86)Mozilla Firefoxgeckodriver.exe");

System.setProperty("phantomjs.binary.path", "C:phantomjs-2.1.1-windowsinphantomjs.exe");

// WebDriver driver = new FirefoxDriver();

WebDriver driver = new PhantomJSDriver();

driver.get("http://www.baidu.com");

System.out.println(driver.getCurrentUrl());

}

}

993170529fb4881dde369e178c0b7628.png4.url成功打印5.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值