私はwww.zomato.comを1週間以上掻き取ろうとしていましたが、ネット上で問題を調査しましたが、適切な解決策が見つかりませんでした。だから私はここに私の質問を掲載した。
pythonとselenium webdriverを使用してhttpsウェブサイトデータをスクラブする方法
ここは、私のウェブスクレイパーのコードです。
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import sys
import lxml
import unittest, time, re
class Sel(unittest.TestCase):
def setUp(self):
self.driver = webdriver.PhantomJS(executable_path='\phantomjs.exe')#phantom js
self.driver.implicitly_wait(30)
self.base_url = "https://www.zomato.com"
self.verificationErrors = []
self.accept_next_alert = True
def test_sel(self):
driver = self.driver
delay = 3
driver.get(self.base_url + "hyderabad")
driver.find_element_by_link_text("All").click()
for i in range(1,100):
self.driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
time.sleep(4)
html_source = driver.page_source
data = html_source.encode('utf-8')
if __name__ == "__main__":
私のpython 3.4、すなわち、ディレクトリ/ PY -3.4 selenium.py で実行すると、私はこのエラー
selenium-python-phantomJS-SSLを取得します。
誰でもこの問題について私を助けることができますか?
よろしくお願いいたします。
は、スクリーンショットにリンクしていない、エラーメッセージのテキストを貼り付けます。 –