click_page.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:core-python 作者: yidao620c 项目源码 文件源码
def just_click():
    # ????????
    _driver = webdriver.PhantomJS()
    _driver.get('https://www.xncoding.com/archives/')
    # driver.maximize_window()
    posts_count = len(_driver.find_elements_by_xpath(
        '//article/header/h1[@class="post-title"]/a[@class="post-title-link"]'))
    for cc in range(1, posts_count + 1):
        l_xpath = '(//article/header/h1[@class="post-title"]/a[@class="post-title-link"])[{}]'.format(cc)
        ele = WebDriverWait(_driver, 10).until(
            EC.element_to_be_clickable((By.XPATH, l_xpath))
        )
        _log.info('???{}???'.format(cc))
        ele.click()
        WebDriverWait(_driver, 10).until(
            EC.presence_of_element_located((By.XPATH, '//div[@class="post-body"]'))
        )
        _driver.back()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号