不在错误中爆发,就在错误中死亡呀.
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'
//待改