Check Box in Webpage Checked or not
package com.Test.web;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class CheckBox {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("https://www.irctc.co.in");
driver.manage().window().maximize();
if (!driver.findElement(By.id("otpId")).isSelected());
{
driver.findElement(By.id("otpId")).click();
}
}
}
package com.Test.web;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class CheckBox {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("https://www.irctc.co.in");
driver.manage().window().maximize();
if (!driver.findElement(By.id("otpId")).isSelected());
{
driver.findElement(By.id("otpId")).click();
}
}
}
No comments:
Post a Comment