如何在AWS sagemaker中使用硒?

时间:2019-05-29 15:21:57

标签: amazon-web-services selenium web-scraping amazon-sagemaker

我正在AWS的sagemaker中使用硒进行Web抓取项目。我已经将chromedriver.exe文件上传到了与笔记本电脑相同的文件夹中,但是始终出现错误“ WebDriverException:消息:'chromedriver.exe'可执行文件需要放在PATH中。”。谁能给我一些建议或意见?万分感谢!

这是我在SageMaker中的代码:

from selenium import webdriver
from bs4 import BeautifulSoup
options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument('--incognito')
options.add_argument('--headless') 
options.add_argument('--dns-prefetch-disable') 

driver = webdriver.Chrome("chromedriver", chrome_options=options)  

enter image description here

0 个答案:

没有答案