小编Mat*_*Law的帖子

会话未创建:此版本的ChromeDriver仅支持ChromeDriver出现Chrome 74版本错误,Chrome浏览器使用Selenium

我正在尝试使用rsDriver函数运行RSelenium,但是当我运行时,出现 rD <- rsDriver() 一条消息告诉我我需要更新版本的Chrome:

> rD <- rsDriver()
checking Selenium Server versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking chromedriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking geckodriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking phantomjs versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
[1] "Connecting to remote server"

Selenium message:session not created: This version of ChromeDriver only supports Chrome version 74
  (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Mac OS X 10.14.3 x86_64)

Could not open chrome browser.
Client error message: …
Run Code Online (Sandbox Code Playgroud)

selenium google-chrome r selenium-chromedriver rselenium

89
推荐指数
7
解决办法
14万
查看次数

创建新的 jekyll 站点时遇到问题:“无法找到 Gemfile 或 .bundle/ 目录”

我正在尝试创建一个托管在 GitHub Pages 上的 Jekyll 站点,并且一直遵循GitHub Pages 教程来执行此操作。

当我bundle exec jekyll 4.0.1 new在终端中运行时(如教程中的步骤 7 所示,4.0.1 是我机器上的 jekyll 版本),它失败并显示Could not locate Gemfile or .bundle/ directory.

jekyll -v我已经仔细检查了、git --versionbundler -v、的依赖关系ruby -vgem -v并且所有依赖项都已安装,所以我不确定哪里出了问题。

我运行的是 macOS 10.15.4。

rubygems jekyll github-pages

12
推荐指数
1
解决办法
3524
查看次数

使用for循环从Python中的beautifulsoup爬取只会返回最后一个结果

我正在尝试使用beautifulsoup从网页上抓取数据,并将其(最终)输出到csv中。作为第一步,我尝试获取相关表的文本。我设法做到了,但是当我重新运行它时,代码不再为我提供相同的输出:运行for循环时,它不会保存所有的12372条记录,而只是保存了最后一条。

我的代码的缩写版本是:

from bs4 import BeautifulSoup
BirthsSoup = BeautifulSoup(browser.page_source, features="html.parser")
print(BirthsSoup.prettify()) 
# this confirms that the soup has captured the page as I want it to

birthsTable = BirthsSoup.select('#t2 td')
# selects all the elements in the table I want

birthsLen = len(birthsTable)
# birthsLen: 12372

for i in range(birthsLen):
    print(birthsTable[i].prettify())
# this confirms that the beautifulsoup tag object correctly captured all of the table

for i in range(birthsLen):
    birthsText = birthsTable[i].getText()
# this was supposed to compile the text …
Run Code Online (Sandbox Code Playgroud)

python beautifulsoup

0
推荐指数
1
解决办法
174
查看次数

seq_along 给出列号而不是行号

我正在尝试编写一个 for 循环,该循环从数据帧中的现有变量创建一个新变量,并通过依次迭代每一行来实现。我尝试过使用for (i in seq_along(data)),但这只为前 19 行正确创建了新变量,我意识到这并seq_along没有像我预期的那样工作:它不是根据行数创建序列,而是根据关于列数:

seq_along(data)回报

[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

nrow(data)返回时

[1] 82

ncol(data)返回

[1] 19

此外, 的输出与seq(data)的输出相同seq_along,并length(data)返回[1] 19

虽然我有一个解决方法可以解决 for 循环 ( for (i in 1:nrow(data))) 的问题,但我很想知道seq_along(andseqlength) 的行为不符合我预期的原因是什么。

r seq

0
推荐指数
1
解决办法
3291
查看次数