我试图从这个网站(https://www.tusubtitulo.com/season/26/10)下载一个文件,使用一个带有selenium的python脚本
这里是代码:
from selenium import webdriver
site="https://www.tusubtitulo.com/season/26/10"
driver = webdriver.PhantomJS()
el = driver.find_element_by_link_text("Descargar").click()
driver.close()
但我收到了这个错误:
^{pr2}$链接以查看xpath:http://imgur.com/a/kNWzC 我也尝试过使用xpath,正如在多个答案中解释的那样,结果是相同的:
from selenium import webdriver
site="https://www.tusubtitulo.com/season/26/10"
driver = webdriver.PhantomJS()
xpath=".//*[@id='episodes']/table[1]/tbody/tr[3]/td[7]/a"
el = driver.find_element_by_xpath(xpath).click()
driver.close()
同样的结果。在
但是如果我使用“WebDriverWait”方法,我会得到一个不同的错误:
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
site="https://www.tusubtitulo.com/season/382/7"
driver = webdriver.PhantomJS()
xpath = ".//*[@id='episodes']/table[3]/tbody/tr[3]/td[7]/a"
element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.XPATH, xpath))).click()
driver.close()
错误:
raise TimeoutException(message, screen, stacktrace)
TimeoutException
任何帮助都将不胜感激。在
我是你所指网站的管理员。我们的系统不允许来自脚本的请求。你需要从你的浏览器下载。这是我们的规矩。在
相关问题 更多 >
编程相关推荐