Selenium webdriver - Selecting checkbox based on table value or specific value


HTML Page


<html>
<head><title>Selenium webdriver - Selecting checkbox based on table value or specific value</title>
</head>
<body>
<table border=2>
<tr>
 <td>Nash</td>
 <td><input type="checkbox" id="N"/></td>
</tr>
</table>
</body>
</html>



Selenium-Code

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class SelectSpecificCheckBox
{
public static void main(String[] args)
 {

WebDriver driver=new FirefoxDriver();
driver.get("E:\\Practice Example\\TableCheckbox.htm");
driver.findElement(By.xpath("//td[contains(text(),'Nash')]/following-sibling::td/input[@id='N']")).click();
driver.close();
}


}

Post a Comment

2 Comments

  1. Helpful Article with good explation

    ReplyDelete
  2. fausse de montres, combinant un style élégant et une technologie de pointe, une variété de styles de fausse rolex datejust montres, le pointeur marche entre votre style de goût exclusif.

    ReplyDelete
Emoji
(y)
:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
x-)
(k)