# data[].attributes.body
package com.Automation;

import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;

public class Controls {
public static void main(String args[]) {
System.setProperty("webdriver.chrome.driver","D:\\Driver\\chromedriver.exe");
ChromeDriver driver = new ChromeDriver();
//webpage URL
driver.get("https://www.facebook.com/");
//text box
driver.findElement(By.xpath("//*[@id=\"email\"]")).sendKeys("xyz@gmail.com");
driver.findElement(By.xpath("//*[@id=\"pass\"]")).sendKeys("123456789");
driver.findElement(By.name("login")).click();

}

}

# data[].attributes.body
package com.Automation;

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class Controls1 {

public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","D:\\Driver\\chromedriver.exe");
ChromeDriver driver = new ChromeDriver();
driver.get("file:///D:/Automation/hjkhk.html");
//drop box  method
WebElement cb=driver.findElement(By.id("s1"));
cb.click();
cb.sendKeys("Volvo");
cb.sendKeys(Keys.ENTER);
driver.findElement(By.xpath("/html/body/form[2]/input[2]")).click();
driver.findElement(By.xpath("/html/body/form[1]/input[2]")).click();

}

}

# data[].attributes.body
package com.Automation;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;

public class link {
public static void main(String []args) {
System.setProperty("webdriver.chrome.driver","D:\\Driver\\chromedriver.exe");
ChromeDriver driver=new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.google.com/");
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.findElement(By.linkText("About")).click();
driver.quit();

}
}

# data[].attributes.body
package com.Automation;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class finfalllinks {

public static void main(String[] args) {

System.setProperty("webdriver.chrome.driver", "D:\\driver\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://alphagroup.edu/arts-science/index.php");

java.util.List<WebElement> links = driver.findElements(By.tagName("a"));

System.out.println(links.size());

for (int i = 1; i<=links.size(); i=i+1)

{

System.out.println(links.get(i).getText());

}

}

}

# data[].attributes.body
package com.Automation;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;

public class mouseover {

public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","D:\\Driver\\chromedriver.exe");
ChromeDriver driver=new ChromeDriver();
driver.manage().window().maximize();
driver.get("http://www.training-in-chennai.com/");
WebElement m=driver.findElement(By.xpath("/html/body/div[4]/header/div[2]/div/div/div/nav/div[2]/ul/li[3]/a"));
WebElement s=driver.findElement(By.xpath("/html/body/div[4]/header/div[2]/div/div/div/nav/div[2]/ul/li[3]/ul/li[2]/a"));
Actions act =new Actions(driver);
act.moveToElement(m).moveToElement(s).click().build().perform();
}

}

# data[].attributes.body
package testngdemo;

import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

public class ClassOne {
@BeforeClass
public void beforeclass() {
System.out.println("Beforeclass");
}
@AfterClass
public void afterclass() {
System.out.println("afterclass");
}
@BeforeMethod
public void beforemethod() {
System.out.println("Before Method");
}
@AfterMethod
public void Aftermethod() {
System.out.println("After Method");
}
@Test
public void test2() {
System.out.println("Test2");
}
@Test
public void test3() {
System.out.println("Test3");
}
@Test
public void test4() {
System.out.println("Test 4");

}
}

# data[].attributes.body
package com.AnotationEx1;
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.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import org.testng.annotations.Test;

public class AnotationEx2 {

WebDriver driver;

@Test
public void testDragAndDropExample() {
System.setProperty("webdriver.chrome.driver","D:\\driver\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("http://jqueryui.com/droppable/");

//Wait for the frame to be available and switch to it
WebDriverWait wait = new WebDriverWait(driver, 5);
wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.cssSelector(".demo-frame")));

WebElement Sourcelocator = driver.findElement(By.cssSelector(".ui-draggable"));
WebElement Destinationlocator = driver.findElement(By.cssSelector(".ui-droppable"));
dragAndDrop(Sourcelocator,Destinationlocator);

//checkpoint
String actualText=driver.findElement(By.cssSelector("#droppable>p")).getText();
Assert.assertEquals(actualText, "Dropped!");
}
public void dragAndDrop(WebElement sourceElement, WebElement destinationElement)
{
(new Actions(driver)).dragAndDrop(sourceElement, destinationElement).perform();
}
}

# data[].attributes.body
package com.Testng;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
import org.openqa.selenium.JavascriptExecutor;

public class TestNG {
WebDriver driver;
String URL = "https://www.linkedin.com/";

@BeforeSuite
public void setUp() {
System.setProperty("webdriver.chrome.driver", "D:\\driver\\chromedriver.exe");
driver = new ChromeDriver();
driver.get(URL);
driver.manage().window().maximize();
}

@Test()
public void scrollingToBottomofAPage() {
((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
driver.findElement(By.linkText("Companies")).click();
}

@AfterClass
public void tearDown() {
//driver.quit();

}
}

# data[].attributes.body
package pagescroll;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
import org.openqa.selenium.JavascriptExecutor;
public class Pagescrollpart2 {
public static WebDriver driver;
String URL = "https://www.linkedin.com/";

@BeforeSuite
public void setUp() {
System.setProperty("webdriver.chrome.driver", "D:\\driver\\chromedriver.exe");
driver = new ChromeDriver();
driver.get(URL);
driver.manage().window().maximize();
}
@Test()
public void scrollingToElementofAPage() throws InterruptedException {

WebElement element = driver.findElement(By.linkText("Marketing"));
((JavascriptExecutor) driver).executeScript(
"arguments[0].scrollIntoView();", element);

}

}

# data[].attributes.body
package pagescroll;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
import org.openqa.selenium.JavascriptExecutor;
public class PageScrollpart3 {
public static WebDriver driver;
String URL = "https://www.linkedin.com/";

@BeforeSuite
public void setUp() {
System.setProperty("webdriver.chrome.driver", "D:\\driver\\chromedriver.exe");
driver = new ChromeDriver();
driver.get(URL);
driver.manage().window().maximize();
}
@Test
public void scrollingByCoordinatesofAPage() {

((JavascriptExecutor) driver).executeScript("window.scrollBy(0,5000)");
}
}

# data[].attributes.attachment_link.title
Selenium interview question and answer part 1

# data[].attributes.attachment_link.title
selenium interview question and answer part 2

# data[].attributes.attachment_link.title
JAVA + SELENIUM AUTOMATION TESTING SYLLABUS

# data[].attributes.body
package com.TestNG;

import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
//import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class Iframe {
WebDriver driver;
@BeforeTest
public void setup() throws Exception {
System.setProperty("webdriver.chrome.driver","D://driver//chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("http://only-testing-blog.blogspot.in/2015/01/iframe1.html");
}

@Test
public void handleFrames(){

//Working with Iframe1 elements
//switch to frame1 and select cow checkbox from table. frame1 Is ID of frame.
driver.switchTo().frame("frame1");
driver.findElement(By.xpath("//td[contains(text(),'Cow')]/preceding-sibling::td/input[@type='checkbox']")).click();

//Switch back to page content.
driver.switchTo().defaultContent();

//Working with Iframe2 elements
//switch to frame2 and select I have a boat checkbox.  frame2 Is ID of frame.
driver.switchTo().frame("frame2");
driver.findElement(By.xpath("//input[@value='Boat']")).click();

//switch back to page to Inserting some text In Country textbox of page.
driver.switchTo().defaultContent();
driver.findElement(By.xpath("//input[@name='Country']")).sendKeys("your country");
}
}