Menu

IEDriverTest

By testautomation | Selenium Code

Aug 27
package selenium;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;

public class IEDriverTest {

	public static void main(String[] args) throws InterruptedException {
		// TODO Auto-generated method stub
		System.setProperty("webdriver.ie.driver", "C:\\IEDriver\\IEDriverServer_Win32_3.14.0\\IEDriverServer.exe");
		WebDriver driver = new InternetExplorerDriver();
		driver.get("https://www.google.com");
		System.out.println(driver.getTitle());
		System.out.println(driver.getCurrentUrl());
		// System.out.println("Its page source - " + driver.getPageSource());
		WebElement searchBox = driver.findElement(By.name("q"));
		// input[@title='Search' and @type='text']
		// WebElement searchBox = driver.findElement(By.xpath("//input[@title='Search'
		// and @type='text']"));
		searchBox.sendKeys("TestAutomation.co");
		WebElement submitSearchBtn = driver.findElement(By.name("btnK"));
		submitSearchBtn.submit();
//		
		//driver.quit();

	}

}

About the Author

Leave a Comment:

Leave a Comment: