# -*- coding: utf-8 -*- __author__ = 'Liuyang' import sys from src.main.python.service.scrapy.Job.Job.utils.FileUtil import FileUtil from src.main.python.dao.jobDao.CsvCao import SaveToCsv from src.main.python.service.scrapy.Job.Job.utils.strUtil import StrUtil from selenium import webdriver from scrapy.http import HtmlResponse import time import re import logging.config logging.config.fileConfig(FileUtil().getLogConfigPath()) logger = logging.getLogger('ahu') WIPOPath = u"WIPO.csv" class WIPOJobsSpider(object): def __init__(self): self.driver = webdriver.PhantomJS() def start(self): self.driver.get('https://wipo.taleo.net/careersection/wp_2/jobsearch.ftl?lang=en#') self.driver.maximize_window() self.driver.implicitly_wait(30) time.sleep(3) if 'Job' in self.driver.page_source: response = HtmlResponse(url="my HTML string", body=self.driver.page_source, encoding="utf-8") links = response.xpath('//div[@class="multiline-data-container"]/div/span/a/@href').extract()
def test_getLogConfigPath(self): path = FileUtil().getLogConfigPath() print path
def test_getResoursePath(self): path = FileUtil().getResoursePath() print path
def __init__(self): self.path = FileUtil().getResoursePath() + "/data/jobData/"