Ieclass - Java: Import Import Import Import
Ieclass - Java: Import Import Import Import
java
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
System.setProperty("webdriver.ie.driver",
"C:\\Users\\b\\Myworkspace\\IEProject\\Lib\\IEDriverServer.exe");
WebDriver ieDriver = new InternetExplorerDriver();
ieDriver.get("https://www.w3schools.com/");
ieDriver.findElement(By.xpath("html/body/nav[1]/div/a[1]")).click();
//ieDriver.findElement(By.xpath("html/body/div[2]/div[8]/div[1]/div[2]/a[5]"))
.click();
myClass.java
package myProject;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;
System.setProperty("webdriver.ie.driver","C:\\Users\\b\\Myworkspace\\myProject
\\Lib\\IEDriverServer.exe");
WebDriver ieDriver = new InternetExplorerDriver();
//ieDriver.get("http://www.facebook.com/");
ieDriver.navigate().to("http://rediffmail.com");
ieDriver.manage().window().maximize();
ieDriver.findElement(By.xpath("//*[@id='signin_info']/a[1]")).click();
//sign in path
// try {
// Thread.sleep(5000);
// } catch (InterruptedException e) {
// TODO Auto-generated catch block
// e.printStackTrace();
// }
//ieDriver.findElement(By.xpath("html/body/div[1]/div[1]/div[2]/a")).click();
//login page
//ieDriver.navigate().forward();
ieDriver.navigate().back();
Thread.sleep(5000);
ieDriver.findElement(By.xpath("//*[@id='hm_top_navlink_div']/a[5]/div")).click
();
ieDriver.navigate().back();
//ieDriver.navigate().refresh();
//ieDriver.close();
//ieDriver.quit();
//ieDriver.findElement(By.xpath("//*[@id='mySidenav']/div/a[text()='Learn
CSS']/preceding-sibling::a[1]")).click();
//ieDriver.findElement(By.xpath("//*[@id='mySidenav']/div/a[text()='Learn
CSS']/following-sibling::a[8]")).click();
//ieDriver.findElement(By.id("mySidenav"));
//ieDriver.findElement(By.xpath("//*[@id='navbtn_examples']")).click();
//ieDriver.findElement(By.xpath("html/body/div[5]/div/a[1]")).click();
//ieDriver.findElement(By.xpath("//*[@id='gsc-i-id1']"));
//ieDriver.findElement(By.name("search")).sendKeys("search by name");
//ieDriver.findElement(By.className("gsc-input"));
//ieDriver.findElement(By.xpath("//*[@id='login_form']/table/tbody/tr[3]/td[2]
/div/a"));
//ieDriver.findElement(By.linkText("Forgotten account?")).click();
//ieDriver.findElement(By.partialLinkText("account?")).click();
//ieDriver.getTitle();
//ieDriver.findElement(By.name("email")).sendKeys("XYZ@gmail.com");
//ieDriver.findElement(By.name("pass")).sendKeys("ABC");
//ieDriver.findElement(By.id("u_0_2")).click();
DynamicXPathClass.java
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;
System.setProperty("webdriver.ie.driver",
"C:\\Users\\b\\Myworkspace\\DynamicXPathProject\\Lib\\IEDriverServer.exe");
ieDriver.get("http://yahoo.com");
ieDriver.manage().window().maximize();
ieDriver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
ieDriver.findElement(By.xpath("//*[@id='uh-search-
box']")).sendKeys("selenium");
Thread.sleep(3000);
System.out.println(list.size());
RadioClass.Java
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;
System.setProperty("webdriver.ie.driver","C:\\Users\\b\\Myworkspace\\NewRadio\
\Lib\\IEDriverServer.exe");
WebDriver ieDriver = new InternetExplorerDriver();
ieDriver.get("http://www.echoecho.com/htmlforms10.htm");
ieDriver.manage().window().maximize();
ieDriver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
List<WebElement> list =
ieDriver.findElements(By.xpath("//input[@name='group1']"));
System.out.println(list.size());
for(WebElement e:list)
{
System.out.println(e.getAttribute("value"));
System.out.println(e.isSelected());
if(e.getAttribute("value").equals("Cheese")){
e.click();
}
}
System.out.println("------------------");
for(WebElement e:list)
{
System.out.println(e.getAttribute("value"));
System.out.println(e.isSelected());
ieDriver.get("http://online.pizzahut.co.in");
ieDriver.manage().window().maximize();