zoukankan      html  css  js  c++  java
  • selenium 51job 淘宝

    51job

    from selenium import webdriver
    from selenium.webdriver.common.keys import Keys
    import time
    
    web = webdriver.Chrome(executable_path='D:develop_studychromedriverchromedriver')
    web.get('https://www.51job.com/')
    
    web.find_element_by_xpath('//*[@id="kwdselectid"]').send_keys('电工',Keys.ENTER)  # 发送键盘信息
    div_list = web.find_element_by_id("resultList").find_elements_by_class_name('el')[1:]
    for div in div_list:
        a = div.find_element_by_xpath('p/span/a')
        a.click()
        time.sleep(1)
        #切换窗口
        web.switch_to.window((web.window_handles[-1]))
        details = web.find_element_by_xpath('/html/body/div[3]/div[2]/div[3]/div[1]/div')
        print(details.text)
        web.close()
        web.switch_to.window(web.window_handles[0])
        time.sleep(2)
        print('----------------------------------------------------')
    
    
    

    taobao

    from selenium import webdriver
    from selenium.webdriver.common.keys import Keys
    import time
    
    web = webdriver.Chrome(executable_path='D:develop_studychromedriverchromedriver')
    web.get('https://www.taobao.com/')
    
    web.find_element_by_xpath('//*[@id="q"]').send_keys('篮球',Keys.ENTER)
    
    while web.current_url.startswith("https://login.taobao.com/"):
        print('请用户扫码或输入账号密码登陆')
        time.sleep(4)
    
    print('淘宝网登陆成功')
    
    
    
  • 相关阅读:
    poj 1743 Musical Theme 后缀数组
    poj 1743 Musical Theme 后缀数组
    cf 432D Prefixes and Suffixes kmp
    cf 432D Prefixes and Suffixes kmp
    hdu Data Structure? 线段树
    关于position和anchorPoint之间的关系
    ios POST 信息
    CALayers的代码示例
    CALayers详解
    ios中得sqlite使用基础
  • 原文地址:https://www.cnblogs.com/chenfei2928/p/12780452.html
Copyright © 2011-2022 走看看