zoukankan      html  css  js  c++  java
  • WebDriver(Selenium2) 常见异常及处理方法

    http://uniquepig.iteye.com/blog/1568197

    Exception NoSuchElementException 
    Solutions    
    1. Check the locator of your target element. 
    2. If the locator is current. Try to wait for page load before find element. 
    3. If already wait for long time and always cannot find the element, try to use another type locator. 

    Exception  NoSuchWindowException 
    Solutions    
    1.Check the window’s locator. 
    2.Wait page load before find the window. 

    Exception  NoAlertPresentException 
    Solutions  
    1.Make sure the alert( javascript pop window not new window) will present. 
    2.Wait page load before deal the alert. 

    Exception  NoSuchFrameException 
    Solutions  
    1.Check the frame’s locator. 
    2.Check is the frame has some father frame.(if has father frame you should switch to the father frame first) 
    3.Make sure switch to the default content before switch to target frame( only for single frame) 
    4.Wait page load before switch to frame. 

    Exception    UnhandledAlertException 
    Solutions
    1. Check if there is some alert dialog present. ( JavaScript pop window). And deal with them. 
    2. If no javascript pop window present but the exception still occurs. Make sure the developer tools is closed when running automation case. (Because since selenium 2.19. “UnhandledAlertException” added and they think the developer tool is an alert) 

    Exception  UnexpectedTagNameException 
    Solutions  
    1.Check the target element’s html tag name. 
    2.Try to wait for page load then initializing the selector. 

    Exception  StaleElementReferenceException 
    Solutions  
    1.Re-find the element again. (Because the element has been refresh.) 

    Exception  TimeoutException 
    Solutions  
    1. Check the expected conditions locator. 
    2..Increase the wait time. 

  • 相关阅读:
    面试问题 集锦
    减少 lwip 消耗 的 RAM
    Blocking Master Example QT 自带 的 serial 即 串口 例子
    32位 的变量 用于表示 ms ,可以表示多少天那?
    centos 腾讯云 今天买了 18个月
    Linux BLE 基于 树莓派
    树莓派 4G模块 PPP 拨号 NDIS 拨号
    linux备份还原命令
    centos7中/tmp文件保存天数
    centos7查看可登陆用户
  • 原文地址:https://www.cnblogs.com/donaldlee2008/p/5481325.html
Copyright © 2011-2022 走看看