zoukankan      html  css  js  c++  java
  • AttributeError: 'WebDriver' object has no attribute 'switchTo'

    不在错误中爆发,就在错误中死亡呀.

    from selenium import webdriver
    from selenium.webdriver.support.ui import WebDriverWait
    
    driver=webdriver.Firefox()
    waitdd = WebDriverWait(driver, 30);
    driver.get("http://www.w3schools.com/js/tryit.asp?filename=tryjs_alert");
    driver.switchTo().frame("iframeResult");
    driver.findElement(By.xpath("//html/body/button")).click();
    waitdd.until(ExpectedConditions.alertIsPresent());
    driver.switchTo().alert().accept();
    driver.switchTo().defaultContent(); 
    

      

    报错内容:

    Traceback (most recent call last):
    File "D:pcode26.py", line 7, in <module>
    driver.switchTo().frame("iframeResult");
    AttributeError: 'WebDriver' object has no attribute 'switchTo'

    //待改

  • 相关阅读:
    UVA-1595 Symmetry
    UVA-10763 Foreign Exchange
    剑指Offer
    剑指Offer
    剑指Offer
    剑指Offer
    剑指Offer
    剑指Offer
    剑指Offer
    剑指Offer
  • 原文地址:https://www.cnblogs.com/xiaobaichuangtianxia/p/3716493.html
Copyright © 2011-2022 走看看