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

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 <module>
driver.switchTo().frame("iframeResult");
AttributeError: 'WebDriver' object has no attribute 'switchTo'

 

//待改

posted on 2014-05-08 16:34  小白闯天下  阅读(14501)  评论(2编辑  收藏  举报