我是 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
知道确切的问题是什么吗?
最佳答案
指定您正在使用的协议(protocol),因此不要使用 localhost:3000
,而是使用 http://localhost:3000
。如果这没有帮助,请参阅评论 here在 Chromium 问题跟踪器上。
关于google-chrome - Chrome 用 selenium 打开 "Data;",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37159684/