Rselenium 问题:浏览器打开和关闭时出错

Rselenium issue: browser opens and closes with an error

RSelenium 存在一些问题。它显示以下错误

rD <- rsDriver(port=4444L,browser="chrome")
remDr <- rD$client

浏览器打开和关闭错误

Selenium message:unknown error: unable to discover open pages
(Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 60.76 seconds Build info: version: '3.4.0', revision: 'unknown', time: 'unknown' System info: host: 'HYD2-1860002767', ip: '10.54.67.19', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_131' Driver info: driver.version: ChromeDriver

Error: Summary: UnknownError Detail: An unknown server-side error occurred while processing the command. class: org.openqa.selenium.WebDriverException Further Details: run errorDetails method

如何克服这个错误?

确保您已在项目中正确添加独立 jar。您可以从 seleniumhq 的官方网站下载它。 java -jar selenium-server-standalone-x.xx.x.jar

如果您已成功添加 jar,请尝试以下代码:

`

public class Google {

    public static void main(String[] args) throws InterruptedException {
        System.setProperty("webdriver.chrome.driver","***location of your chromedriver.exe***");
        WebDriver driver = new ChromeDriver();
        driver.manage().window().maximize();
        driver.get("https://www.google.com/");
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);        

`