- Selenium WebDriver 3 Practical Guide
- Unmesh Gundecha Satya Avasarala
- 89字
- 2021-08-13 16:08:15
Writing your first test script for the IE browser
Now you are all set to write test scripts that run on the Internet Explorer browser. The following is the code that instantiates InternetExplorerDriver:
public class SearchTest {
WebDriver driver;
@BeforeMethod
public void setup() {
System.setProperty("webdriver.ie.driver",
"./src/test/resources/drivers/IEDriverServer.exe");
driver = new InternetExplorerDriver();
driver.get("http://demo-store.seleniumacademy.com/");
}
@Test
public void searchProduct() {
// find search box and enter search string
WebElement searchBox = driver.findElement(By.name("q"));
searchBox.sendKeys("Phones");
WebElement searchButton =
driver.findElement(By.className("search-button"));
searchButton.click();
assertThat(driver.getTitle())
.isEqualTo("Search results for: 'Phones'");
}
@AfterMethod
public void tearDown() {
driver.quit();
}
}
推薦閱讀
- 6G潛在關(guān)鍵技術(shù)(下冊)
- 物聯(lián)網(wǎng)(IoT)基礎(chǔ):網(wǎng)絡(luò)技術(shù)+協(xié)議+用例
- 物聯(lián)網(wǎng)+BIM:構(gòu)建數(shù)字孿生的未來
- Mastering TypeScript 3
- 智慧光網(wǎng)絡(luò):關(guān)鍵技術(shù)、應(yīng)用實踐和未來演進
- Microsoft Dynamics CRM 2011 Applications(MB2-868) Certification Guide
- 光纖通信系統(tǒng)與網(wǎng)絡(luò)(修訂版)
- 搶占下一個智能風口:移動物聯(lián)網(wǎng)
- 新手易學:新手學淘寶開店
- 數(shù)據(jù)血緣分析原理與實踐
- 物聯(lián)網(wǎng)與智慧農(nóng)業(yè)
- 物聯(lián)網(wǎng),So Easy!
- 走近2050:注意力、互聯(lián)網(wǎng)與人工智能
- 網(wǎng)絡(luò)編碼應(yīng)用
- 校園網(wǎng)絡(luò)規(guī)劃與架設(shè)