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('淘宝网登陆成功')
    
    
    
  • 相关阅读:
    ADC测试matlab代码
    matlab的滤波器仿真——低通滤波器与插值滤波器
    PDF转Image最终方案
    多线程和蕃茄炒蛋
    git学习总结
    踩坑了,当前目录问题
    Angular 1.x 升级到 Angular 2
    打造AngularJs2.0开发环境
    发布一个自用的ansi转utf8程序
    用itextsharp打印pdf示例
  • 原文地址:https://www.cnblogs.com/chenfei2928/p/12780452.html
Copyright © 2011-2022 走看看