Note : Select the playlist as per your need & move with number sequence
For video : Click Here
To get the code to access different elements like, checkbox, radio button, dropbox, listbox etc
click here
By this below code we will access "Different WebElements" from selenium practice Page of "www.way2testing.com" using WebDriver
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.Test;
public class Basic
{
WebDriver driver;
@Test
public void test() throws InterruptedException
{
driver = new FirefoxDriver();
driver.navigate().to("http://www.way2testing.com/2017/01/selenium-practice-page.html");
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
driver.manage().window().maximize();
WebElement firstname = driver.findElement(By.xpath("/html/body/div[3]/div[2]/div[2]/div[2]/div[2]/div[2]/div[2]/div/div[4]/div[1]/div/div/div/div[1]/div/div/div/div[1]/div[2]/form/input[1]"));
firstname.clear();
firstname.sendKeys("chandan singh");
driver.findElement(By.xpath("/html/body/div[3]/div[2]/div[2]/div[2]/div[2]/div[2]/div[2]/div/div[4]/div[1]/div/div/div/div[1]/div/div/div/div[1]/div[2]/form/input[5]")).click();
Select obj = new Select(driver.findElement(By.xpath("/html/body/div[3]/div[2]/div[2]/div[2]/div[2]/div[2]/div[2]/div/div[4]/div[1]/div/div/div/div[1]/div/div/div/div[1]/div[2]/form/select")));
obj.selectByIndex(2);
}
}
Note : For Selenium Practice Page
Click Here
Tags :How to access webelements in selenium
Selenium code to access web element
No comments:
Post a Comment