java编写自动化测试出现 selenium Only local connections are allowed

selenium Only local connections are allowed
selenium踩过的一个坑,chromeDriver 不能打开页面,开始以为Only local connections are allowed是报错,只能打开本地的链接,百度了半天没找着解决办法

public class Auto {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        System.setProperty("webdriver.chrome.driver", "D:\\其他文件\\自动化驱动\\chromedriver.exe");
        WebDriver driver=new ChromeDriver();
        driver.get("https://www.baidu.com/?tn=48021271_15_hao_pg");
      //  driver.close();
  
    }

}

运行得到的结果是这样的
这里只要给"www.baidu.com"加上‘https://’就可以打开百度了,然而控制台还是会输出红字Only local connections are allowed。

 

小技巧:

1.可以将所有的driver写入到path系统环境变量中 就可以省略:System.setProperty("webdriver.chrome.driver", "D:\\其他文件\\自动化驱动\\chromedriver.exe");

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
chromedriver,v2.24,支持chrome v52-54. ----------ChromeDriver v2.24 (2016-09-09)---------- Supports Chrome v52-54 Resolved issue 1497: GetLog fails when the current window is closed [['OS-All', 'Pri-0']] Resolved issue 1495: ChromeDriver crashes with "Check failed: !page_load_strategy_.empty()" [['OS-All', 'Pri-0']] Resolved issue 1463: SessionNotCreatedException: Runtime.evaluate missing 'wasThrown' on Chrome 54+ [['OS-All', 'Pri-0']] Resolved issue 1484: SendKeys of a Tab Key has no effect in Chrome 53 [['OS-All', 'Pri-1']] Resolved issue 1431: GetLog command does not work for Chrome 54+ [['OS-All', 'Pri-1']] Resolved issue 1411: sendKeys generates events that are missing some fields [['OS-All', 'Pri-1']] Resolved issue 1451: Chrome 54+ session not created exception: Runtime.executionContextCreated has invalid 'context' [['Pri-1']] Resolved issue 984: Extend ChromeDriver capabilities to cover network throttling feature from Chrome DevTools [['OS-All', 'Pri-2']] Resolved issue 1454: Net::ReadTimeout error on launching Canary v54 through RemoteWebDriver [[]] ----------ChromeDriver v2.23 (2016-08-04)---------- Supports Chrome v51-53 Resolved issue 1378: Android 6: Intitialization of Chrome driver fails when Chrome/Webview process is in running (R) state [['OS-Android', 'Pri-1']] Resolved issue 1379: Chromedriver does not catch all available browser console log entries [['OS-All', 'Pri-2']] ----------ChromeDriver v2.22 (2016-06-06)---------- Supports Chrome v49-52 Resolved issue 1348: Timeout error while navigating to URL on Chrome 51+ [['OS-All', 'Pri-0']] Resolved issue 1381: Timeout error occurs when alert dialog is displayed on Chrome 52+ [['OS-All', 'Pri-1', 'merge-merged-2743']] Resolved issue 1339: Failure when executing JS in a content script context [['OS-All', 'Pri-1']] Resolved issue 1387: ChromeDriver hangs when calling driver.get() for same-process navigations [['OS-All', 'Pri-1']] Resolved issue 1365: Touch emulation is not working under mobile emulation

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小赖同学啊

跟着大师走,路不会太差

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值