相关疑难解决方法(0)

如何在 Colaboratory Google 上使用 Selenium?

我从网上抓取了很多信息,我希望它可以在云上运行。所以我想使用 colaboratory,但它变成了错误

WebDriverException                        Traceback (most recent call last)
<ipython-input-35-abcc3b93dfa7> in <module>()
     20 options.add_argument("--start-maximized");
     21 options.add_argument("--headless");
---> 22 driver = webdriver.Chrome('chromedriver', chrome_options=options)
     23 
     24 book  = cd + "/target.xlsx"

/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py in __init__(self, executable_path, port, options, service_args, desired_capabilities, service_log_path, chrome_options, keep_alive)
     71             service_args=service_args,
     72             log_path=service_log_path)
---> 73         self.service.start()
     74 
     75         try:

/usr/local/lib/python3.6/dist-packages/selenium/webdriver/common/service.py in start(self)
     96         count = 0
     97         while True:
---> 98             self.assert_process_still_running()
     99             if self.is_connectable():
    100                 break

/usr/local/lib/python3.6/dist-packages/selenium/webdriver/common/service.py in assert_process_still_running(self)
    109             raise WebDriverException(
    110                 'Service %s unexpectedly exited. Status code …
Run Code Online (Sandbox Code Playgroud)

python selenium python-3.x selenium-chromedriver selenium-webdriver

7
推荐指数
2
解决办法
6468
查看次数

如何在 google colab 中为 geckodriver 插入路径(环境变量)?

我想通过 Gecko 驱动程序在 Google Colab 中运行 selenium,但它告诉我:可执行文件需要在 PATH 中

我在 Google Colab 中上传了 firefox 和 gecko 驱动程序并复制了 gecko 驱动程序的路径。该代码在我的 PC 上运行良好。

google clob 中的 firefox 和 gecko 驱动程序,但发生错误。

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait as wait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
import time
from selenium.webdriver.support import ui
from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

from selenium.common.exceptions import TimeoutException


driver =  webdriver.Firefox(executable_path=r'content/geckodriver.exe')

WebDriverException: Message: 'content/geckodriver.exe' executable needs to be …
Run Code Online (Sandbox Code Playgroud)

firefox selenium path geckodriver google-colaboratory

5
推荐指数
1
解决办法
5050
查看次数

我们可以在selenium中添加驱动程序作为maven depandancies

我们可以在POM中添加gecko驱动程序,即驱动程序或chrome驱动程序作为depandancy吗?我试图搜索但无法在https://mvnrepository.com/artifact上对它们进行处理.他们没有被放置在maven存储库的任何原因?

selenium maven selenium-webdriver

3
推荐指数
1
解决办法
1549
查看次数

从 Python Beautifulsoup 中抓取表格

我试图从这个网站刮表:https : //stockrow.com/VRTX/financials/income/quarterly

我正在使用 Python Google Colab,我希望将日期作为列。(例如 2020-06-30 等)我用代码来做这样的事情:

source = urllib.request.urlopen('https://stockrow.com/VRTX/financials/income/quarterly').read()
soup = bs.BeautifulSoup(source,'lxml')
table = soup.find_all('table')
Run Code Online (Sandbox Code Playgroud)

但是,我无法拿到桌子。我对抓取有点陌生,所以我查看了其他 Stackoverflow 页面,但无法解决问题。你能帮我么?那将不胜感激。

python beautifulsoup web-scraping google-colaboratory

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