2016-05-12 39 views
0

它僅返回本地主機地址。我想知道是否有人可以指引我走向正確的方向?它與下面的代碼返回的URL地址如下: 當前的URL http://localhost:14423/Selenium中的IE WebDriver的getCurrentUrl()方法僅返回localhost

我使用的代碼是......

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 
+0

試着睡覺。 –

+0

謝謝桑傑,可以從這個YouTube視頻中找到解決方案。這是由IE設置引起的! https://www.youtube.com/watch?v=GxTHU_91Z1Q – Rodger75

回答

相關問題