0
在Firefox中使用Selenium WebDriver開始測試運行時,出現「錯誤請求」異常。我將這個問題追溯到主機配置文件(使用Windows 7)。我的機器上的主機文件有這條線(當然,稍做修改):當主機文件沒有localhost別名時,我可以運行Selenium測試嗎?
127.0.0.1 alias.set.by.security
這應該通過將localhost添加到該行來解決。問題是,我無法更改此文件,我們有一個安全工具,依賴於此並覆蓋我的權限。 我發現一個與此相關的問題,https://code.google.com/p/selenium/issues/detail?id=3280
但是,他們對如何使用修復程序有點神祕。有人知道如何修復我的代碼以使其工作(它不工作)?
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference(FirefoxProfile.ALLOWED_HOSTS_PREFERENCE, "localhost");
driver = new FirefoxDriver(profile);
你使用的webdriver的版本?在運行硒測試時,我看不到任何問題,即使我的主機文件條目沒有127.0.0.1的localhost值。 – 2014-10-08 08:45:08
最新,2.43.1。現在用我放在下面的代碼正常工作 – vicusbass 2014-10-08 12:29:04