实践过程用到的小tips

判断是否有alert弹出框,并相应操作 

    #判断是否有alert框
    result = EC.alert_is_present()(driver)
    if result:
        print(result.text)
        result.accept()
    else:
        print( "alert 未弹出!")

判断元素是否可点击、展示等--参考文档

https://blog.csdn.net/weixin_40894921/article/details/88367716

wait = WebDriverWait(driver, 30)
    wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '.el-input__inner[placeholder=请输入]')))

双击操作 参考文档

https://blog.csdn.net/xiaodanpeng/article/details/50999026

 ele_li=driver.find_element_by_xpath('/html/body/div[2]/div[1]/div[1]/ul/li['+str(num)+']')
    ActionChains(driver).double_click(ele_li).perform()

滚动条问题-参考文档

https://blog.csdn.net/weixin_43277055/article/details/109655178

还有些小的总结 参考文档

https://blog.csdn.net/weixin_44439071/article/details/103820605

JS的各种使用--输入内容、清空等等

https://www.cnblogs.com/linuxchao/p/linuxchao-js.html

定位父子节点-参考文档(好用!!)

https://blog.csdn.net/huilan_same/article/details/52541680

层级定位元素-参考文档(看起来好用!!!)

https://zhuanlan.zhihu.com/p/30990827

猜你喜欢

转载自blog.csdn.net/honghong3864/article/details/115215437