selenium+phantomjs 无法找到页面元素?

试着爬http://data.futures.hexun.com...用了selenium+phantomjs,但是出了问题.
不管怎么样也找不到想要的标签.
希望各位大神能帮小弟一把.

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

url = "http://data.futures.hexun.com/cccj.aspx"
driver = webdriver.PhantomJS(executable_path="phantomjs.exe")
driver.get(url)
try:
    elem = WebDriverWait(driver,10).until(
        EC.presence_of_element_located((By.ID,"sExc1")))
finally:
    elem = driver.find_elements_by_id("sExc1")
    print(len(elem))

报错:

0
Traceback (most recent call last):
  File "E:\AreaX\code\PythonCode\Pbug\netbug.py", line 14, in <module>
    EC.presence_of_element_located((By.ID,"sExc1")))
  File "C:\Users\Rem\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: 
Screenshot: available via screen
阅读 5k
1 个回答

网站有反爬技术

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题