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('淘宝网登陆成功')
    
    
    
  • 相关阅读:
    Emacs for OIer 的一些配置
    CF1336E Chiori and Doll Picking 【线性代数,组合计数】
    CF605E Intergalaxy Trips 【贪心,动态规划,期望】
    Luogu6329 【模板】点分树 | 震波
    [SDOI2014]数表
    [BZOJ4403]序列统计
    [BZOJ5099]Pionek
    SP1812 LCS2
    SA & SAM
    [HAOI2016]找相同字符
  • 原文地址:https://www.cnblogs.com/chenfei2928/p/12780452.html
Copyright © 2011-2022 走看看