Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google chrome Chrome以“打开”;数据&引用;含硒_Google Chrome_Selenium_Selenium Webdriver_Google Chrome Devtools_Ui Automation - Fatal编程技术网

Google chrome Chrome以“打开”;数据&引用;含硒

Google chrome Chrome以“打开”;数据&引用;含硒,google-chrome,selenium,selenium-webdriver,google-chrome-devtools,ui-automation,Google Chrome,Selenium,Selenium Webdriver,Google Chrome Devtools,Ui Automation,我是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.chrom

我是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");
    }

}
但是,这会打开带有“data;”的chrome窗口。 chrome版本为50.0.2661.94


知道确切的问题是什么吗?

指定您正在使用的协议,因此使用
localhost:3000而不是
http://localhost:3000
。如果这没有帮助,请参阅Chromium issue tracker上的评论。

是,它将以数据开始。数据之后,请尝试给出URL。“数据:,”URL只是chromedriver在启动chrome时导航到的默认地址。所以这本身并不一定意味着任何事情都出了问题

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("https://www.google.co.in/?gfe_rd=cr&ei=KxAzV8-KEJPT8gfT0IWYAw");
}

}

它将成功打开。如果您有任何疑问,请回复。快乐学习…-)

我一直在类似的情况下运行,我的案例中的修复方法就是将chrome webdriver升级到其最新版本(在我的案例中是V2.27)

显示
数据的原因而不是实际的应用程序URL是:

WebDriver driver = new RemoteWebDriver(new URL("http://<host>:<port>/wd/hub"), desiredCapabilities);
WebDriver-driver=新的RemoteWebDriver(新的URL(“http:/:/wd/hub”),所需的功能);
无法创建。相反,
driver
对象持有一个
null

所以在chrome驱动程序升级后,它被正确创建并解决了问题


希望这能帮助那些仍然被困的人

确保您正在使用(目前为2.28)。我对
数据:,
也有同样的问题。由于错误,我下载了旧版本,并且遇到了指定URL未打开的问题,只是
数据:,
我也遇到了同样的问题。我将ChromeDriver更新为,并将其修复。

只需将“ChromeDriver.exe”替换为

当我在python中使用selenium网格时发生了这种情况,这是由于与其他答案不同(至少在我的情况下)

事实证明,在创建驱动程序对象(并连接到chrome)之后,但在指示其导航到URL之前,会引发运行时异常。这一切都在芹菜任务队列上运行,所以我很容易错过。因此,如果更新chrome驱动程序不起作用,请仔细检查您是否正确导航到URL,是否没有错误等

例如:

driver=webdriver.Remote(
command_executor=“http://:4444/wd/hub”,
)
#此处的函数引发运行时异常,导致chrome启动
#但是使用默认URL“data;/”坐在那里
driver.get(“www.google.com”)

如果您使用的是Codeception,请从以下内容开始测试:


$I->amOnPage('/')

您需要添加两件事来运行:

首先-您应该使用
http://localhost:3000

第二,在创建webDriver之前,必须使用调试端口:
options.addArguments(“--remote debug port=9225”)

全部代码:

    WebDriverManager.chromedriver().setup();
    ChromeOptions options = new ChromeOptions();
    options.setExperimentalOption("useAutomationExtension", false);
    options.addArguments("--remote-debugging-port=9225");
    WebDriver driver = new ChromeDriver(options);

如果您有任何查询,请删除注释

如果您手动粘贴到chrome localhost:3000,它会返回什么?如果有人在使用文件路径时遇到相同问题,请不要忘记在路径
驱动程序之前附加“file://”file:///path/to/index.html“”
您至少可以指明更新到的版本,所以任何对此感兴趣的人都可以进行比较。我使用的是支持Chrome版本55-57的Chrome驱动程序2.28。下载Chrome驱动程序的链接适用于我Chromedriver版本2.32和Chrome版本59 workedIt看起来他们在Chromedriver 88.0.4324.96中再次修复了它。如果您在现场模式下进行本地测试,驱动程序版本应该与浏览器版本匹配。有时上游回购协议(如npm或brew)会落在后面,因此,为了以防万一,请下载最新版本)