使用Selenium和IE和IEdriverServer的自动化测试问题

时间:2019-07-02 14:33:46

标签: selenium internet-explorer testing driver

我正在使用Selenium 3.14.0和IE11,IEDriverServer_Win32_3.14.0

      /**
 * try for 5 attemps to find element
 * 
 * @param element
 */
public void Attempt_Find_Element(WebElement element) {
    int numAttemps = 0;
    int specifiedAttempts = 30;
    boolean success = false;

    do {
        numAttemps++;
        try {
            // access the element
            success = element.isDisplayed();
            // success = true; //<--If it reaches here 
     means success
        } catch (NoSuchElementException | 
   StaleElementReferenceException  nse) {
            // one attempt failed
        }
    } while (!success || numAttemps < specifiedAttempts);

    if (!success) {
        System.out.println("Couldn't load after " + numAttemps 
   + " attempts");
    }
} 

我正在收到以下异常:

org.openqa.selenium.WebDriverException: Returned value cannot be 
converted to Boolean: Error executing JavaScript
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08- 
02T20:19:58.91Z'System info: host: 'MAROC89', ip: '192.168.220.71', 
os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: 
'1.8.0_161'Driver info: driver.version: unknown

请提出任何想法,如果您可以向我建议使用IE的其他版本

1 个答案:

答案 0 :(得分:0)

尝试一下,因为您需要返回一些东西:

file = open(filePath, encoding="latin_1")