zoukankan      html  css  js  c++  java
  • python selenium1 模拟点击 测试对象 58同城验证码

    #!/usr/bin/python
    # -*- coding: UTF-8 -*-
    # @Time : 2019/12/5 17:30
    # @Author : shenghao/10347899@qq.com
    '''test with selenium's click'''

    '''click 58 urls is https://callback.58.com/antibot/verifycode?serialId=62cbf64a21ab4d309e722680c623a4e4_31ec33353c0648b7a5c97b1f2fb35976&code=22&sign=e6760461fc971994a2f3809ff536fbe9&namespace=anjuke_zufang_pc&url=.zu.anjuke.com%2Ffangyuan%2F1206610285371393%3Fisauction%3D1%26shangquan_id%3D1846'''

    from selenium import webdriver
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    from selenium.webdriver.common.by import By
    import datetime,time



    mobileEmulation = {'deviceName': 'iPhone X'}
    chrome_option = webdriver.ChromeOptions()
    chrome_option.add_experimental_option('mobileEmulation', mobileEmulation)
    browser = webdriver.Chrome(executable_path="C:Program FilesPython37chromedriver.exe",chrome_options=chrome_option)
    browser.get("https://callback.58.com/antibot/verifycode?serialId=62cbf64a21ab4d309e722680c623a4e4_31ec33353c0648b7a5c97b1f2fb35976&code=22&sign=e6760461fc971994a2f3809ff536fbe9&namespace=anjuke_zufang_pc&url=.zu.anjuke.com%2Ffangyuan%2F1206610285371393%3Fisauction%3D1%26shangquan_id%3D1846")
    #sleep 1s
    # time.sleep(1)
    try:
    click_status = WebDriverWait(browser,5,1).until(EC.element_to_be_clickable((By.XPATH,"//div[@class = 'code_num']/input"))).click()
    # browser.element_to_be_clickable("//div[@class = 'code_num']/input").click()
    print(click_status)
    time.sleep(0.3)
    browser.close()
    except:
    pass
    print(datetime.datetime.now())
  • 相关阅读:
    BZOJ 1013: [JSOI2008]球形空间产生器sphere
    BZOJ 1012: [JSOI2008]最大数maxnumber
    BZOJ 1011: [HNOI2008]遥远的行星
    BZOJ 1008: [HNOI2008]越狱
    BZOJ 1007: [HNOI2008]水平可见直线
    BZOJ 1003: [ZJOI2006]物流运输
    Spark core 总结
    SparkRDD算子(transformations算子和actions算子)
    SparkRDD算子初识
    初识Spark
  • 原文地址:https://www.cnblogs.com/tnsay/p/11991017.html
Copyright © 2011-2022 走看看