我經常收到 「沒有這樣的元素異常」 爲 「名」 測試箱硒WD - southwest.com
下面是我的代碼:
public class southwestSignUpSave {
WebDriver oBrw;
@Before
public void loadwebsite(){
oBrw = new FirefoxDriver();
oBrw.manage().window().maximize();
oBrw.get("https://southwest.com");
oBrw.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void signUpAndSave(){
oBrw.findElement(By.partialLinkText("OFFERS")).click();
oBrw.findElement(By.partialLinkText("Sign")).click();
//oBrw.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
WebDriverWait oWait = new WebDriverWait(oBrw, 30);
oWait.until(ExpectedConditions.presenceOfElementLocated(By.id("FIRST_NAME")));
oBrw.findElement(By.id("FIRST_NAME")).clear();
oBrw.findElement(By.id("FIRST_NAME")).sendKeys("abc");
oBrw.findElement(By.id("LAST_NAME")).clear();
oBrw.findElement(By.id("LAST_NAME")).sendKeys("asd");
oBrw.findElement(By.id("EMAIL")).clear();
oBrw.findElement(By.id("EMAIL")).sendKeys("[email protected]");
new Select(oBrw.findElement(By.id("HOME_AIRPORT"))).selectByVisibleText("Akron/Canton, OH - CAK");
oBrw.findElement(By.id("IAN")).click();
}
}
我試着使用ID和名稱。
我在哪裏出錯了。我是Selenium的新手WD
是這個作品..只是多了一個問題,oBrw.switchTo()。幀(0) – user5465511
你看什麼參數幀(0)中的「0」 – user5465511