- 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();
}
}
推薦閱讀
- Mastering Node.js(Second Edition)
- 物聯(lián)網(wǎng)網(wǎng)絡安全及應用
- Hands-On Industrial Internet of Things
- Hands-On Chatbot Development with Alexa Skills and Amazon Lex
- Oracle SOA Suite 11g Performance Tuning Cookbook
- Windows Server 2003 Active Directory Design and Implementation: Creating, Migrating, and Merging Networks
- 中小型局域網(wǎng)組建、管理與維護實戰(zhàn)
- 計算機網(wǎng)絡原理與應用技術
- 區(qū)塊鏈輕松上手:原理、源碼、搭建與應用
- Yii Application Development Cookbook(Second Edition)
- Microservice Patterns and Best Practices
- Kong網(wǎng)關:入門、實戰(zhàn)與進階
- 網(wǎng)絡環(huán)境中基于用戶視角的信息質量評價研究
- AIoT應用開發(fā)與實踐
- 轉化:提升網(wǎng)站流量和轉化率的技巧