2016-05-12 42 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

回答

相关问题