R “我如何解决?”;xml缺失";和维斯特?

R “我如何解决?”;xml缺失";和维斯特?,r,rvest,rselenium,R,Rvest,Rselenium,这是我试图获取所需信息的网页: 这是与我重置的节点关联的XPath: //*[@id="box-listing"]/div[1] 使用时 out %>%html_node(xpath = '//*[@id="box-listing"]/div[1]') 我发现了以下错误 {xml_missing} <NA> {xml_缺失} 要解决您的问题,我建议您使用Rselinium 我们有两大类网站。静态网站和动态网站。 第一个在代码中包含

这是我试图获取所需信息的网页:

这是与我重置的节点关联的XPath:

//*[@id="box-listing"]/div[1]
使用时

out %>%html_node(xpath = '//*[@id="box-listing"]/div[1]')
我发现了以下错误

{xml_missing}
<NA>
{xml_缺失}

要解决您的问题,我建议您使用
Rselinium

我们有两大类网站。静态网站和动态网站。 第一个在代码中包含我们需要的信息(例如Wikipidia网页),而第二个在代码中并没有实际的信息,但是每次我们需要它时它都会通过Javascript代码(例如Trip Advisor)。 多亏了
Rselenium
库,我们能够从动态网站中获取信息。 什么是硒?
RSelenium
是一个R库,但我们可以在
Python
Java
等其他类型的代码中找到它,它能够模拟人类行为。 Selenium的主要用途是测试应用程序的自动化,但并非如此

硒是一个非常大的世界()。

关于Rselenium,我建议您查看以下链接:

下面是一个关于您的问题使用Rselenium的小示例:

    library(RSelenium)
    
    #We start the RSelenium environment
    driver <- rsDriver(browser=c("firefox"),port = 4445L)
    remote_driver <- driver[["client"]]  
    
    #We send the url to the firefox browser
    remote_driver$navigate("https://www.immobiliare.it/ricerca-mappa/Torino,TO/#/linkZona_/latitudine_45.04462/longitudine_7.68199/idContratto_1/idCategoria_23/zoom_16/pag_1")
    
    Below some example of the Rselenium powerful
    
    #We get the text
    text_1<-remote_driver$findElement(using = "css selector", '#box-listing > div:nth-child(1) > div:nth-child(1)')$getElementText()
    print(text_1)
    [[1]]
    [1] "PREMIUM\nImmobile\n€ 150.000\n60 m² • 2 locali"

    #We click the element
    remote_driver$findElement(using = "css selector", '#box-listing > div:nth-child(1) > div:nth-child(1)')$clickElement()
库(RSelenium)
#我们启动了硒环境

驱动程序要解决您的问题,我建议您使用
Rselinium

我们有两大类网站。静态网站和动态网站。 第一个在代码中包含我们需要的信息(例如Wikipidia网页),而第二个在代码中并没有实际的信息,但是每次我们需要它时它都会通过Javascript代码(例如Trip Advisor)。 多亏了
Rselenium
库,我们能够从动态网站中获取信息。 什么是硒?
RSelenium
是一个R库,但我们可以在
Python
Java
等其他类型的代码中找到它,它能够模拟人类行为。 Selenium的主要用途是测试应用程序的自动化,但并非如此

硒是一个非常大的世界()。

关于Rselenium,我建议您查看以下链接:

下面是一个关于您的问题使用Rselenium的小示例:

    library(RSelenium)
    
    #We start the RSelenium environment
    driver <- rsDriver(browser=c("firefox"),port = 4445L)
    remote_driver <- driver[["client"]]  
    
    #We send the url to the firefox browser
    remote_driver$navigate("https://www.immobiliare.it/ricerca-mappa/Torino,TO/#/linkZona_/latitudine_45.04462/longitudine_7.68199/idContratto_1/idCategoria_23/zoom_16/pag_1")
    
    Below some example of the Rselenium powerful
    
    #We get the text
    text_1<-remote_driver$findElement(using = "css selector", '#box-listing > div:nth-child(1) > div:nth-child(1)')$getElementText()
    print(text_1)
    [[1]]
    [1] "PREMIUM\nImmobile\n€ 150.000\n60 m² • 2 locali"

    #We click the element
    remote_driver$findElement(using = "css selector", '#box-listing > div:nth-child(1) > div:nth-child(1)')$clickElement()
库(RSelenium)
#我们启动了硒环境

驱动程序我不确定是否有
html\u节点
,但许多刮削工具不支持https。如果您只有一个页面,请尝试从浏览器中保存它,然后阅读您的本地副本。谢谢,经过一些研究,我相信这是由于动态更新了页面。我正在查看Selenium软件包,并试图找出如何使用itI。我不确定
html\u节点
,但许多刮削工具不支持https。如果您只有一个页面,请尝试从浏览器中保存它,然后阅读您的本地副本。谢谢,经过一些研究,我相信这是由于动态更新了页面。我正在寻找硒包装,并试图找出如何使用它