【发布时间】:2016-09-06 16:19:56
【问题描述】:
我是 Selenium 的新手,并试图通过 selenium 驱动程序从 Chrome 打开 localhost:3000 页面。 代码是:
import com.google.common.base.Function;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class SeleniumTests {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C://chromedriver_win32//chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("localhost:3000");
}
}
但是,这会打开我的 chrome 窗口并显示“数据;” . chrome版本是50.0.2661.94
知道具体的问题是什么吗?
【问题讨论】:
-
如果你手动粘贴到 chrome localhost:3000 会返回什么?
-
如果有人在使用文件路径时遇到同样的问题,请不要忘记在路径
driver.get("file:///path/to/index.html")之前附加“file:///”
标签: google-chrome selenium selenium-webdriver google-chrome-devtools ui-automation