Selenium中IE WebDriver的getCurrentUrl()方法仅返回localhost

时间:2016-05-12 20:58:19

标签: internet-explorer selenium-webdriver

它只返回本地主机地址。我想知道是否有人能指出我正确的方向?它返回的URL地址与下面的代码如下: 当前网址http://localhost:14423/

我正在使用的代码是......

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

public class IEBrowserProblem {
    public static WebDriver driver;

    public static void main(String[] args) {

        //Set up Ie driver
        System.setProperty("webdriver.ie.driver", "C:\\IeDriverFolder/IEDriverServer_x64_2.53.0/IEDriverServer.exe" );
        driver = new InternetExplorerDriver();

        driver.get("http://localhost:4295/"); // I only included this in an attempt to overcome the issue
        driver.navigate().to("http://www.google.co.uk");

        String url4 = driver.getCurrentUrl();
        System.out.println("current url " + url4);

         driver.close();  

    }//main

}//class

1 个答案:

答案 0 :(得分:0)

https://www.youtube.com/watch?v=GxTHU_91Z1Q

找到答案

它连接到您需要手动配置的IE设置。