2017-06-22 19 views
-1

为什么在使用PhantomJS Selenium这个特殊的URL时找不到标签,但是在使用Chromedriver Selenium时可以找到它?为什么Selenium和PhantomJS找不到标签,但Selenium和Chromedriver可以找到标签?

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

driver = webdriver.PhantomJS('c:/Users/info_000/AppData/Roaming/npm/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs.exe') 
# driver = webdriver.Chrome('E:/Work/IdeaProjects/web_loaders/movie_scraper/chromedriver.exe') 


url = 'https://gomovies.to/film/gilmore-girls-a-year-in-the-life-season-1-18045/' 
print('opening %s' % url) 
driver.get(url) 
content = driver.find_element_by_class_name('mvi-cover') 
content.click() 
print('after click') 
src = WebDriverWait(driver, 10).until(
    ec.presence_of_element_located((By.TAG_NAME, 'video')) 
).get_attribute('src') 
+0

您可以考虑在我们的SO志愿者处就您之前的问题提供的答案进行处理,并在提出新问题前接受/关闭这些讨论?谢谢 – DebanjanB

+1

@DebanjanB,你是对的。但在提出这个问题之前,我已经做了一些研究。问题中的大多数答案“Selenium找不到标签”都是等待使用,或者此标签在