我正在使用Selenium-python和PhantomJS.代码非常像这样:
from selenium.webdriver import PhantomJS from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions driver = PhantomJS() wait = WebDriverWait(driver, 10) driver.get(url) while True: // scrap the page try: driver.find_elements_by_css_selector('.next')[0].click() except: break wait.until(expected_conditions.visibility_of_element_located((By.CSS_SELECTOR, '.loading'))) wait.until(expected_conditions.invisibility_of_element_located((By.CSS_SELECTOR, '.loading'))) driver.quit()
我使用芹菜任务定期运行此代码.问题在于,有时会出现一些过时的幻影过程.当我查看芹菜日志时,任务成功完成,没有任何错误,但phantomjs进程仍在运行.
一些额外的信息:
我正在使用Python 3.2
我正在使用Celery 3.1
我正在使用Debian Wheezy
我从源代码编译了PhamtomJS并创建了一个这样的符号链接: ln -s /opt/phantomjs/bin/phantomjs /usr/local/bin/
有人可以建议一种方法来调试并找出这是谁的错吗?