AttributeError: 'WebDriver' object has no attribute 'switchTo'

您所在的位置:网站首页 iframeresult AttributeError: 'WebDriver' object has no attribute 'switchTo'

AttributeError: 'WebDriver' object has no attribute 'switchTo'

2023-04-02 15:12| 来源: 网络整理| 查看: 265

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

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:\pcode\26.py", line 7, in driver.switchTo().frame("iframeResult");AttributeError: 'WebDriver' object has no attribute 'switchTo'

 

//待改



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3