我想在带有 Selenium Python 包的 Google Colaboratory 中使用 geckodriver。这是我尝试过的(我不是 Ubuntu 专家)
!pip install selenium
!apt-get update
!apt install firefox-geckodriver
from selenium.webdriver.firefox.options import Options as FirefoxOptions
firefox_options = FirefoxOptions()
firefox_options.add_argument("--headless")
driver = webdriver.Firefox(executable_path=r'/usr/bin/firefox', options=firefox_options)
Run Code Online (Sandbox Code Playgroud)
这里r'/usr/bin/firefox
是错误的。我糊涂了。解决办法是什么?任何帮助表示赞赏。
firefox python-3.x selenium-webdriver geckodriver google-colaboratory
我的代码如下
def write_cells(spreadsheet_id, update_data):
updating = sheet_service.spreadsheets().values().\
batchUpdate(spreadsheetId=spreadsheet_id, body=update_data)
updating.execute()
spreadsheet_data = [
{
"deleteDimension": {
"range": {
"sheetId": sheet_id,
"dimension": "ROWS",
"startIndex": 5,
"endIndex": 100
}
}
}
]
update_spreadsheet_data = {
'valueInputOption': 'USER_ENTERED',
'data': spreadsheet_data
}
update_data = update_spreadsheet_data
write_cells(spreadsheet_id, update_data)
Run Code Online (Sandbox Code Playgroud)
我有以下错误消息
HttpError Traceback (most recent call last)
<ipython-input-64-0ba8756b8e85> in <module>()
----> 1 write_cells(spreadsheet_id, update_data)
Run Code Online (Sandbox Code Playgroud)
2帧
/usr/local/lib/python3.6/dist-packages/googleapiclient/http.py in execute(self, http, num_retries)
838 callback(resp)
839 if resp.status >= 300:
--> 840 raise HttpError(resp, content, uri=self.uri)
841 return self.postproc(resp, …
Run Code Online (Sandbox Code Playgroud) google-sheets python-3.x google-sheets-api google-colaboratory